<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>Python成品：运用turtle模块绘画 | Amnesia's blog</title><meta name="keywords" content="“Python，成品，turtle”"><meta name="author" content="Amnesia"><meta name="copyright" content="Amnesia"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="Turtle模块的函数1.画笔移动函数   函数 功能    forward(n) 向画笔的当前方向移动n像素的距离   backward(n) 向画笔当前方向的相反方向移动n像素的距离   left(n) 让画笔逆时针旋转n度   right(n) 让画笔顺时针旋转n度   pendown() 落下画笔   penup() 抬起画笔   speed(s) 设置画笔的移动速度，int(s&#x3D;0~1">
<meta property="og:type" content="article">
<meta property="og:title" content="Python成品：运用turtle模块绘画">
<meta property="og:url" content="http://amnesia-f.github.io/posts/7c82/index.html">
<meta property="og:site_name" content="Amnesia&#39;s blog">
<meta property="og:description" content="Turtle模块的函数1.画笔移动函数   函数 功能    forward(n) 向画笔的当前方向移动n像素的距离   backward(n) 向画笔当前方向的相反方向移动n像素的距离   left(n) 让画笔逆时针旋转n度   right(n) 让画笔顺时针旋转n度   pendown() 落下画笔   penup() 抬起画笔   speed(s) 设置画笔的移动速度，int(s&#x3D;0~1">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://img.imgdb.cn/item/6012b60e3ffa7d37b3e66e13.jpg">
<meta property="article:published_time" content="2021-01-28T12:51:42.000Z">
<meta property="article:modified_time" content="2021-01-28T13:44:30.459Z">
<meta property="article:author" content="Amnesia">
<meta property="article:tag" content="Python">
<meta property="article:tag" content="成品">
<meta property="article:tag" content="turtle模块">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://img.imgdb.cn/item/6012b60e3ffa7d37b3e66e13.jpg"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="http://amnesia-f.github.io/posts/7c82/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//www.google-analytics.com" crossorigin=""/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css" media="print" onload="this.media='all'"><script async="async" src="https://www.googletagmanager.com/gtag/js?id=UA-172938598-1"></script><script>window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-172938598-1');
</script><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":300},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":50,"languages":{"author":"作者: Amnesia","link":"链接: ","source":"来源: Amnesia's blog","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  lightbox: 'fancybox',
  Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#49b1f5","bgDark":"#121212","position":"bottom-left"},
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'Python成品：运用turtle模块绘画',
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2021-01-28 21:44:30'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
          const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
          const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
          const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified

          if (t === undefined) {
            if (isLightMode) activateLightMode()
            else if (isDarkMode) activateDarkMode()
            else if (isNotSpecified || hasNoSupport) {
              const now = new Date()
              const hour = now.getHours()
              const isNight = hour <= 6 || hour >= 18
              isNight ? activateDarkMode() : activateLightMode()
            }
            window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
              if (saveToLocal.get('theme') === undefined) {
                e.matches ? activateDarkMode() : activateLightMode()
              }
            })
          } else if (t === 'light') activateLightMode()
          else activateDarkMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/css/iconfont.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/static-butterfly/dist/css/index.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/css/scrollbar.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/HCLonely/images@master/others/heartbeat.min.css"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" media="defer" onload="this.media='all'"><link rel="stylesheet" href="/css/custom/twikoo_beautify.css"  media="defer" onload="this.media='all'"><!-- hexo injector head_end start --><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-swiper/swiper/swiper.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-swiper/swiper/swiperstyle.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-card-history/baiduhistory/css/main.css"><link rel="stylesheet" href="https://unpkg.zhimg.com/hexo-butterfly-wowjs/lib/animate.min.css" media="print" onload="this.media='screen'"><!-- hexo injector head_end end --><meta name="generator" content="Hexo 6.0.0"><link rel="alternate" href="/atom.xml" title="Amnesia's blog" type="application/atom+xml">
<link rel="alternate" href="/rss2.xml" title="Amnesia's blog" type="application/rss+xml">
</head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/avatar.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data is-center"><div class="data-item"><a href="/archives/"><div class="headline">文章</div><div class="length-num">57</div></a></div><div class="data-item"><a href="/tags/"><div class="headline">标签</div><div class="length-num">44</div></a></div><div class="data-item"><a href="/categories/"><div class="headline">分类</div><div class="length-num">19</div></a></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-compass"></i><span> 目录</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></li></ul></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-file-code"></i><span> HTML游戏</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/HTML/Demo/%E5%9C%88%E5%B0%8F%E7%8C%AB.html"><i class="fa-fw fas fa-code"></i><span> 圈小猫</span></a></li><li><a class="site-page child" href="/HTML/Demo/%E8%B5%B0%E8%BF%B7%E5%AE%AB/index.html"><i class="fa-fw fas fa-code"></i><span> 走迷宫</span></a></li><li><a class="site-page child" href="/HTML/Demo/%E5%9D%A6%E5%85%8B%E5%A4%A7%E6%88%98/index.html"><i class="fa-fw fas fa-code"></i><span> 坦克大战</span></a></li><li><a class="site-page child" href="/HTML/Demo/%E9%A3%9E%E6%9C%BA%E5%A4%A7%E6%88%98/index.html"><i class="fa-fw fas fa-code"></i><span> 飞机大战</span></a></li></ul></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 其他</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li><li><a class="site-page child" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></li><li><a class="site-page child" href="/history/"><i class="fa-fw fas fa-link"></i><span> 建站史</span></a></li><li><a class="site-page child" href="/comments/"><i class="fa-fw fas fa-sticky-note"></i><span> 留言板</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/talking/"><i class="fa-fw fas fa-sticky-note"></i><span> 自言自语</span></a></div><div class="menus_item"><a class="site-page" href="/about/index.html"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://img.imgdb.cn/item/6012b60e3ffa7d37b3e66e13.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">Amnesia's blog</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-compass"></i><span> 目录</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></li></ul></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-file-code"></i><span> HTML游戏</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/HTML/Demo/%E5%9C%88%E5%B0%8F%E7%8C%AB.html"><i class="fa-fw fas fa-code"></i><span> 圈小猫</span></a></li><li><a class="site-page child" href="/HTML/Demo/%E8%B5%B0%E8%BF%B7%E5%AE%AB/index.html"><i class="fa-fw fas fa-code"></i><span> 走迷宫</span></a></li><li><a class="site-page child" href="/HTML/Demo/%E5%9D%A6%E5%85%8B%E5%A4%A7%E6%88%98/index.html"><i class="fa-fw fas fa-code"></i><span> 坦克大战</span></a></li><li><a class="site-page child" href="/HTML/Demo/%E9%A3%9E%E6%9C%BA%E5%A4%A7%E6%88%98/index.html"><i class="fa-fw fas fa-code"></i><span> 飞机大战</span></a></li></ul></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 其他</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/music/"><i class="fa-fw fas fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> 电影</span></a></li><li><a class="site-page child" href="/link/"><i class="fa-fw fas fa-link"></i><span> 友链</span></a></li><li><a class="site-page child" href="/history/"><i class="fa-fw fas fa-link"></i><span> 建站史</span></a></li><li><a class="site-page child" href="/comments/"><i class="fa-fw fas fa-sticky-note"></i><span> 留言板</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/talking/"><i class="fa-fw fas fa-sticky-note"></i><span> 自言自语</span></a></div><div class="menus_item"><a class="site-page" href="/about/index.html"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">Python成品：运用turtle模块绘画</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2021-01-28T12:51:42.000Z" title="发表于 2021-01-28 20:51:42">2021-01-28</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-01-28T13:44:30.459Z" title="更新于 2021-01-28 21:44:30">2021-01-28</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/Python/">Python</a><i class="fas fa-angle-right post-meta-separator"></i><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/Python/%E6%88%90%E5%93%81/">成品</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">3.8k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>19分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="Python成品：运用turtle模块绘画"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span><span class="post-meta-separator">|</span><span class="post-meta-commentcount"><i class="far fa-comments fa-fw post-meta-icon"></i><span class="post-meta-label">评论数:</span><a href="/posts/7c82/#post-comment"><span id="twikoo-count"></span></a></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><p><img src="https://img.imgdb.cn/item/6012b60e3ffa7d37b3e66e13.jpg" alt="封面"></p>
<h1 id="Turtle模块的函数"><a href="#Turtle模块的函数" class="headerlink" title="Turtle模块的函数"></a>Turtle模块的函数</h1><h3 id="1-画笔移动函数"><a href="#1-画笔移动函数" class="headerlink" title="1.画笔移动函数"></a>1.画笔移动函数</h3><table>
<thead>
<tr>
<th align="center">函数</th>
<th align="center">功能</th>
</tr>
</thead>
<tbody><tr>
<td align="center">forward(n)</td>
<td align="center">向画笔的当前方向移动n像素的距离</td>
</tr>
<tr>
<td align="center">backward(n)</td>
<td align="center">向画笔当前方向的相反方向移动n像素的距离</td>
</tr>
<tr>
<td align="center">left(n)</td>
<td align="center">让画笔逆时针旋转n度</td>
</tr>
<tr>
<td align="center">right(n)</td>
<td align="center">让画笔顺时针旋转n度</td>
</tr>
<tr>
<td align="center">pendown()</td>
<td align="center">落下画笔</td>
</tr>
<tr>
<td align="center">penup()</td>
<td align="center">抬起画笔</td>
</tr>
<tr>
<td align="center">speed(s)</td>
<td align="center">设置画笔的移动速度，int(s=0~10)</td>
</tr>
<tr>
<td align="center">goto(x,y)</td>
<td align="center">将画笔移动到坐标为(x,y)的位置</td>
</tr>
<tr>
<td align="center">circle(r,n)</td>
<td align="center">绘制半径为r，角度为n的圆弧，省略n则画圆</td>
</tr>
</tbody></table>
<h3 id="2-画笔控制函数"><a href="#2-画笔控制函数" class="headerlink" title="2.画笔控制函数"></a>2.画笔控制函数</h3><table>
<thead>
<tr>
<th align="center">函数</th>
<th align="center">功能</th>
</tr>
</thead>
<tbody><tr>
<td align="center">pensize(n)</td>
<td align="center">设置画笔的粗细</td>
</tr>
<tr>
<td align="center">pencolor(color)</td>
<td align="center">设置画笔的颜色</td>
</tr>
<tr>
<td align="center">fillcolor(color)</td>
<td align="center">设置图形的填充颜色</td>
</tr>
<tr>
<td align="center">color(color1,color2)</td>
<td align="center">设置画笔的颜色和图形的填充颜色</td>
</tr>
<tr>
<td align="center">begin_fill()</td>
<td align="center">准备开始填充图形</td>
</tr>
<tr>
<td align="center">end_fill()</td>
<td align="center">填充上次调用begin_fill()之后绘制的图形</td>
</tr>
<tr>
<td align="center">hideturtle()</td>
<td align="center">隐藏画笔</td>
</tr>
<tr>
<td align="center">showturtle()</td>
<td align="center">显示画笔</td>
</tr>
</tbody></table>
<h3 id="3-全局控制函数"><a href="#3-全局控制函数" class="headerlink" title="3.全局控制函数"></a>3.全局控制函数</h3><table>
<thead>
<tr>
<th align="center">函数</th>
<th align="center">功能</th>
</tr>
</thead>
<tbody><tr>
<td align="center">clear()</td>
<td align="center">清空画布，不改变画笔位置与状态</td>
</tr>
<tr>
<td align="center">reset()</td>
<td align="center">重置画布，让画笔回到初始状态</td>
</tr>
<tr>
<td align="center">undo()</td>
<td align="center">撤销上一个画笔动作</td>
</tr>
<tr>
<td align="center">stamp()</td>
<td align="center">复制当前图形</td>
</tr>
<tr>
<td align="center">write(a[,m=(“m-name”, m-size, “m-type”)])</td>
<td align="center">在画布上书写文本，a为文本内容</td>
</tr>
</tbody></table>
<h1 id="爱心"><a href="#爱心" class="headerlink" title="爱心"></a>爱心</h1><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> turtle <span class="keyword">import</span> * <span class="comment"># 导入turtle模块</span></span><br><span class="line">color(<span class="string">&quot;red&quot;</span>,<span class="string">&quot;red&quot;</span>)   <span class="comment"># 设置画笔颜色和图形填充颜色</span></span><br><span class="line">pensize(<span class="number">2</span>)           <span class="comment"># 设置画笔粗细</span></span><br><span class="line">penup()              <span class="comment"># 抬起画笔</span></span><br><span class="line">goto(<span class="number">0</span>,-<span class="number">100</span>)         <span class="comment"># 将画笔移动到坐标为(0,-100)的位置</span></span><br><span class="line">pendown()            <span class="comment"># 落下画笔</span></span><br><span class="line">begin_fill()         <span class="comment"># 准备开始填充颜色</span></span><br><span class="line">left(<span class="number">45</span>)             <span class="comment"># 让画笔逆时针旋转45度</span></span><br><span class="line">forward(<span class="number">200</span>)         <span class="comment"># 向画笔的当前方向移动200像素的距离</span></span><br><span class="line">circle(<span class="number">100</span>,<span class="number">180</span>)      <span class="comment"># 绘制半径为100、角度为180的圆弧</span></span><br><span class="line">right(<span class="number">90</span>)            <span class="comment"># 让画笔顺时针旋转90度</span></span><br><span class="line">circle(<span class="number">100</span>,<span class="number">180</span>)      <span class="comment"># 绘制半径为100、角度为180的圆弧</span></span><br><span class="line">forward(<span class="number">200</span>)         <span class="comment"># 向画笔的当前方向移动200像素的距离</span></span><br><span class="line">end_fill()           <span class="comment"># 填充上次调用begin_fill()之后绘制的图形</span></span><br><span class="line">hideturtle()         <span class="comment"># 隐藏画笔</span></span><br></pre></td></tr></table></figure>

<p><img src="https://img.imgdb.cn/item/6012bddc3ffa7d37b3eb0db2.png" alt="爱心"></p>
<h1 id="哆啦A梦"><a href="#哆啦A梦" class="headerlink" title="哆啦A梦"></a>哆啦A梦</h1><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br><span class="line">286</span><br><span class="line">287</span><br><span class="line">288</span><br><span class="line">289</span><br><span class="line">290</span><br><span class="line">291</span><br><span class="line">292</span><br><span class="line">293</span><br><span class="line">294</span><br><span class="line">295</span><br><span class="line">296</span><br><span class="line">297</span><br><span class="line">298</span><br><span class="line">299</span><br><span class="line">300</span><br><span class="line">301</span><br><span class="line">302</span><br><span class="line">303</span><br><span class="line">304</span><br><span class="line">305</span><br><span class="line">306</span><br><span class="line">307</span><br><span class="line">308</span><br><span class="line">309</span><br><span class="line">310</span><br><span class="line">311</span><br><span class="line">312</span><br><span class="line">313</span><br><span class="line">314</span><br><span class="line">315</span><br><span class="line">316</span><br><span class="line">317</span><br><span class="line">318</span><br><span class="line">319</span><br><span class="line">320</span><br><span class="line">321</span><br><span class="line">322</span><br><span class="line">323</span><br><span class="line">324</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> turtle <span class="keyword">import</span> *</span><br><span class="line"></span><br><span class="line"><span class="comment"># 无轨迹跳跃</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">my_goto</span>(<span class="params">x, y</span>):</span></span><br><span class="line">    penup()</span><br><span class="line">    goto(x, y)</span><br><span class="line">    pendown()</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># 眼睛</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">eyes</span>():</span></span><br><span class="line">    fillcolor(<span class="string">&quot;#ffffff&quot;</span>)</span><br><span class="line">    begin_fill()</span><br><span class="line"></span><br><span class="line">    tracer(<span class="literal">False</span>)</span><br><span class="line">    a = <span class="number">2.5</span></span><br><span class="line">    <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">120</span>):</span><br><span class="line">        <span class="keyword">if</span> <span class="number">0</span> &lt;= i &lt; <span class="number">30</span> <span class="keyword">or</span> <span class="number">60</span> &lt;= i &lt; <span class="number">90</span>:</span><br><span class="line">            a -= <span class="number">0.05</span></span><br><span class="line">            lt(<span class="number">3</span>)</span><br><span class="line">            fd(a)</span><br><span class="line">        <span class="keyword">else</span>:</span><br><span class="line">            a += <span class="number">0.05</span></span><br><span class="line">            lt(<span class="number">3</span>)</span><br><span class="line">            fd(a)</span><br><span class="line">    tracer(<span class="literal">True</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># 胡须</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">beard</span>():</span></span><br><span class="line">    my_goto(-<span class="number">32</span>, <span class="number">135</span>)</span><br><span class="line">    seth(<span class="number">165</span>)</span><br><span class="line">    fd(<span class="number">60</span>)</span><br><span class="line"></span><br><span class="line">    my_goto(-<span class="number">32</span>, <span class="number">125</span>)</span><br><span class="line">    seth(<span class="number">180</span>)</span><br><span class="line">    fd(<span class="number">60</span>)</span><br><span class="line"></span><br><span class="line">    my_goto(-<span class="number">32</span>, <span class="number">115</span>)</span><br><span class="line">    seth(<span class="number">193</span>)</span><br><span class="line">    fd(<span class="number">60</span>)</span><br><span class="line"></span><br><span class="line">    my_goto(<span class="number">37</span>, <span class="number">135</span>)</span><br><span class="line">    seth(<span class="number">15</span>)</span><br><span class="line">    fd(<span class="number">60</span>)</span><br><span class="line"></span><br><span class="line">    my_goto(<span class="number">37</span>, <span class="number">125</span>)</span><br><span class="line">    seth(<span class="number">0</span>)</span><br><span class="line">    fd(<span class="number">60</span>)</span><br><span class="line"></span><br><span class="line">    my_goto(<span class="number">37</span>, <span class="number">115</span>)</span><br><span class="line">    seth(-<span class="number">13</span>)</span><br><span class="line">    fd(<span class="number">60</span>)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># 嘴巴</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">mouth</span>():</span></span><br><span class="line">    my_goto(<span class="number">5</span>, <span class="number">148</span>)</span><br><span class="line">    seth(<span class="number">270</span>)</span><br><span class="line">    fd(<span class="number">100</span>)</span><br><span class="line">    seth(<span class="number">0</span>)</span><br><span class="line">    circle(<span class="number">120</span>, <span class="number">50</span>)</span><br><span class="line">    seth(<span class="number">230</span>)</span><br><span class="line">    circle(-<span class="number">120</span>, <span class="number">100</span>)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># 围巾</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">scarf</span>():</span></span><br><span class="line">    fillcolor(<span class="string">&#x27;#e70010&#x27;</span>)</span><br><span class="line">    begin_fill()</span><br><span class="line">    seth(<span class="number">0</span>)</span><br><span class="line">    fd(<span class="number">200</span>)</span><br><span class="line">    circle(-<span class="number">5</span>, <span class="number">90</span>)</span><br><span class="line">    fd(<span class="number">10</span>)</span><br><span class="line">    circle(-<span class="number">5</span>, <span class="number">90</span>)</span><br><span class="line">    fd(<span class="number">207</span>)</span><br><span class="line">    circle(-<span class="number">5</span>, <span class="number">90</span>)</span><br><span class="line">    fd(<span class="number">10</span>)</span><br><span class="line">    circle(-<span class="number">5</span>, <span class="number">90</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># 鼻子</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">nose</span>():</span></span><br><span class="line">    my_goto(-<span class="number">10</span>, <span class="number">158</span>)</span><br><span class="line">    seth(<span class="number">315</span>)</span><br><span class="line">    fillcolor(<span class="string">&#x27;#e70010&#x27;</span>)</span><br><span class="line">    begin_fill()</span><br><span class="line">    circle(<span class="number">20</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># 黑眼睛</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">black_eyes</span>():</span></span><br><span class="line">    seth(<span class="number">0</span>)</span><br><span class="line">    my_goto(-<span class="number">20</span>, <span class="number">195</span>)</span><br><span class="line">    fillcolor(<span class="string">&#x27;#000000&#x27;</span>)</span><br><span class="line">    begin_fill()</span><br><span class="line">    circle(<span class="number">13</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line">    pensize(<span class="number">6</span>)</span><br><span class="line">    my_goto(<span class="number">20</span>, <span class="number">205</span>)</span><br><span class="line">    seth(<span class="number">75</span>)</span><br><span class="line">    circle(-<span class="number">10</span>, <span class="number">150</span>)</span><br><span class="line">    pensize(<span class="number">3</span>)</span><br><span class="line"></span><br><span class="line">    my_goto(-<span class="number">17</span>, <span class="number">200</span>)</span><br><span class="line">    seth(<span class="number">0</span>)</span><br><span class="line">    fillcolor(<span class="string">&#x27;#ffffff&#x27;</span>)</span><br><span class="line">    begin_fill()</span><br><span class="line">    circle(<span class="number">5</span>)</span><br><span class="line">    end_fill()</span><br><span class="line">    my_goto(<span class="number">0</span>, <span class="number">0</span>)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># 脸</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">face</span>():</span></span><br><span class="line">    fd(<span class="number">183</span>)</span><br><span class="line">    lt(<span class="number">45</span>)</span><br><span class="line">    fillcolor(<span class="string">&#x27;#ffffff&#x27;</span>)</span><br><span class="line">    begin_fill()</span><br><span class="line">    circle(<span class="number">120</span>, <span class="number">100</span>)</span><br><span class="line">    seth(<span class="number">180</span>)</span><br><span class="line">    <span class="comment"># print(pos())</span></span><br><span class="line">    fd(<span class="number">121</span>)</span><br><span class="line">    pendown()</span><br><span class="line">    seth(<span class="number">215</span>)</span><br><span class="line">    circle(<span class="number">120</span>, <span class="number">100</span>)</span><br><span class="line">    end_fill()</span><br><span class="line">    my_goto(<span class="number">63.56</span>, <span class="number">218.24</span>)</span><br><span class="line">    seth(<span class="number">90</span>)</span><br><span class="line">    eyes()</span><br><span class="line">    seth(<span class="number">180</span>)</span><br><span class="line">    penup()</span><br><span class="line">    fd(<span class="number">60</span>)</span><br><span class="line">    pendown()</span><br><span class="line">    seth(<span class="number">90</span>)</span><br><span class="line">    eyes()</span><br><span class="line">    penup()</span><br><span class="line">    seth(<span class="number">180</span>)</span><br><span class="line">    fd(<span class="number">64</span>)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># 头型</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">head</span>():</span></span><br><span class="line">    penup()</span><br><span class="line">    circle(<span class="number">150</span>, <span class="number">40</span>)</span><br><span class="line">    pendown()</span><br><span class="line">    fillcolor(<span class="string">&#x27;#00a0de&#x27;</span>)</span><br><span class="line">    begin_fill()</span><br><span class="line">    circle(<span class="number">150</span>, <span class="number">280</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># 画哆啦A梦</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">Doraemon</span>():</span></span><br><span class="line">    <span class="comment"># 头部</span></span><br><span class="line">    head()</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 围脖</span></span><br><span class="line">    scarf()</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 脸</span></span><br><span class="line">    face()</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 红鼻子</span></span><br><span class="line">    nose()</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 嘴巴</span></span><br><span class="line">    mouth()</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 胡须</span></span><br><span class="line">    beard()</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 身体</span></span><br><span class="line">    my_goto(<span class="number">0</span>, <span class="number">0</span>)</span><br><span class="line">    seth(<span class="number">0</span>)</span><br><span class="line">    penup()</span><br><span class="line">    circle(<span class="number">150</span>, <span class="number">50</span>)</span><br><span class="line">    pendown()</span><br><span class="line">    seth(<span class="number">30</span>)</span><br><span class="line">    fd(<span class="number">40</span>)</span><br><span class="line">    seth(<span class="number">70</span>)</span><br><span class="line">    circle(-<span class="number">30</span>, <span class="number">270</span>)</span><br><span class="line"></span><br><span class="line">    fillcolor(<span class="string">&#x27;#00a0de&#x27;</span>)</span><br><span class="line">    begin_fill()</span><br><span class="line"></span><br><span class="line">    seth(<span class="number">230</span>)</span><br><span class="line">    fd(<span class="number">80</span>)</span><br><span class="line">    seth(<span class="number">90</span>)</span><br><span class="line">    circle(<span class="number">1000</span>, <span class="number">1</span>)</span><br><span class="line">    seth(-<span class="number">89</span>)</span><br><span class="line">    circle(-<span class="number">1000</span>, <span class="number">10</span>)</span><br><span class="line"></span><br><span class="line">    <span class="comment"># print(pos())</span></span><br><span class="line"></span><br><span class="line">    seth(<span class="number">180</span>)</span><br><span class="line">    fd(<span class="number">70</span>)</span><br><span class="line">    seth(<span class="number">90</span>)</span><br><span class="line">    circle(<span class="number">30</span>, <span class="number">180</span>)</span><br><span class="line">    seth(<span class="number">180</span>)</span><br><span class="line">    fd(<span class="number">70</span>)</span><br><span class="line"></span><br><span class="line">    <span class="comment"># print(pos())</span></span><br><span class="line">    seth(<span class="number">100</span>)</span><br><span class="line">    circle(-<span class="number">1000</span>, <span class="number">9</span>)</span><br><span class="line"></span><br><span class="line">    seth(-<span class="number">86</span>)</span><br><span class="line">    circle(<span class="number">1000</span>, <span class="number">2</span>)</span><br><span class="line">    seth(<span class="number">230</span>)</span><br><span class="line">    fd(<span class="number">40</span>)</span><br><span class="line"></span><br><span class="line">    <span class="comment"># print(pos())</span></span><br><span class="line"></span><br><span class="line">    circle(-<span class="number">30</span>, <span class="number">230</span>)</span><br><span class="line">    seth(<span class="number">45</span>)</span><br><span class="line">    fd(<span class="number">81</span>)</span><br><span class="line">    seth(<span class="number">0</span>)</span><br><span class="line">    fd(<span class="number">203</span>)</span><br><span class="line">    circle(<span class="number">5</span>, <span class="number">90</span>)</span><br><span class="line">    fd(<span class="number">10</span>)</span><br><span class="line">    circle(<span class="number">5</span>, <span class="number">90</span>)</span><br><span class="line">    fd(<span class="number">7</span>)</span><br><span class="line">    seth(<span class="number">40</span>)</span><br><span class="line">    circle(<span class="number">150</span>, <span class="number">10</span>)</span><br><span class="line">    seth(<span class="number">30</span>)</span><br><span class="line">    fd(<span class="number">40</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 左手</span></span><br><span class="line">    seth(<span class="number">70</span>)</span><br><span class="line">    fillcolor(<span class="string">&#x27;#ffffff&#x27;</span>)</span><br><span class="line">    begin_fill()</span><br><span class="line">    circle(-<span class="number">30</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 脚</span></span><br><span class="line">    my_goto(<span class="number">103.74</span>, -<span class="number">182.59</span>)</span><br><span class="line">    seth(<span class="number">0</span>)</span><br><span class="line">    fillcolor(<span class="string">&#x27;#ffffff&#x27;</span>)</span><br><span class="line">    begin_fill()</span><br><span class="line">    fd(<span class="number">15</span>)</span><br><span class="line">    circle(-<span class="number">15</span>, <span class="number">180</span>)</span><br><span class="line">    fd(<span class="number">90</span>)</span><br><span class="line">    circle(-<span class="number">15</span>, <span class="number">180</span>)</span><br><span class="line">    fd(<span class="number">10</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line">    my_goto(-<span class="number">96.26</span>, -<span class="number">182.59</span>)</span><br><span class="line">    seth(<span class="number">180</span>)</span><br><span class="line">    fillcolor(<span class="string">&#x27;#ffffff&#x27;</span>)</span><br><span class="line">    begin_fill()</span><br><span class="line">    fd(<span class="number">15</span>)</span><br><span class="line">    circle(<span class="number">15</span>, <span class="number">180</span>)</span><br><span class="line">    fd(<span class="number">90</span>)</span><br><span class="line">    circle(<span class="number">15</span>, <span class="number">180</span>)</span><br><span class="line">    fd(<span class="number">10</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 右手</span></span><br><span class="line">    my_goto(-<span class="number">133.97</span>, -<span class="number">91.81</span>)</span><br><span class="line">    seth(<span class="number">50</span>)</span><br><span class="line">    fillcolor(<span class="string">&#x27;#ffffff&#x27;</span>)</span><br><span class="line">    begin_fill()</span><br><span class="line">    circle(<span class="number">30</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 口袋</span></span><br><span class="line">    my_goto(-<span class="number">103.42</span>, <span class="number">15.09</span>)</span><br><span class="line">    seth(<span class="number">0</span>)</span><br><span class="line">    fd(<span class="number">38</span>)</span><br><span class="line">    seth(<span class="number">230</span>)</span><br><span class="line">    begin_fill()</span><br><span class="line">    circle(<span class="number">90</span>, <span class="number">260</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line">    my_goto(<span class="number">5</span>, -<span class="number">40</span>)</span><br><span class="line">    seth(<span class="number">0</span>)</span><br><span class="line">    fd(<span class="number">70</span>)</span><br><span class="line">    seth(-<span class="number">90</span>)</span><br><span class="line">    circle(-<span class="number">70</span>, <span class="number">180</span>)</span><br><span class="line">    seth(<span class="number">0</span>)</span><br><span class="line">    fd(<span class="number">70</span>)</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 铃铛</span></span><br><span class="line">    my_goto(-<span class="number">103.42</span>, <span class="number">15.09</span>)</span><br><span class="line">    fd(<span class="number">90</span>)</span><br><span class="line">    seth(<span class="number">70</span>)</span><br><span class="line">    fillcolor(<span class="string">&#x27;#ffd200&#x27;</span>)</span><br><span class="line">    <span class="comment"># print(pos())</span></span><br><span class="line">    begin_fill()</span><br><span class="line">    circle(-<span class="number">20</span>)</span><br><span class="line">    end_fill()</span><br><span class="line">    seth(<span class="number">170</span>)</span><br><span class="line">    fillcolor(<span class="string">&#x27;#ffd200&#x27;</span>)</span><br><span class="line">    begin_fill()</span><br><span class="line">    circle(-<span class="number">2</span>, <span class="number">180</span>)</span><br><span class="line">    seth(<span class="number">10</span>)</span><br><span class="line">    circle(-<span class="number">100</span>, <span class="number">22</span>)</span><br><span class="line">    circle(-<span class="number">2</span>, <span class="number">180</span>)</span><br><span class="line">    seth(<span class="number">180</span> - <span class="number">10</span>)</span><br><span class="line">    circle(<span class="number">100</span>, <span class="number">22</span>)</span><br><span class="line">    end_fill()</span><br><span class="line">    goto(-<span class="number">13.42</span>, <span class="number">15.09</span>)</span><br><span class="line">    seth(<span class="number">250</span>)</span><br><span class="line">    circle(<span class="number">20</span>, <span class="number">110</span>)</span><br><span class="line">    seth(<span class="number">90</span>)</span><br><span class="line">    fd(<span class="number">15</span>)</span><br><span class="line">    dot(<span class="number">10</span>)</span><br><span class="line">    my_goto(<span class="number">0</span>, -<span class="number">150</span>)</span><br><span class="line"></span><br><span class="line">    <span class="comment"># 画眼睛</span></span><br><span class="line">    black_eyes()</span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">&#x27;__main__&#x27;</span>:</span><br><span class="line">    screensize(<span class="number">800</span>, <span class="number">600</span>, <span class="string">&quot;#f0f0f0&quot;</span>)</span><br><span class="line">    pensize(<span class="number">3</span>)  <span class="comment"># 画笔宽度</span></span><br><span class="line">    speed(<span class="number">3</span>)  <span class="comment"># 画笔速度</span></span><br><span class="line">    Doraemon()</span><br><span class="line">    my_goto(<span class="number">100</span>, -<span class="number">300</span>)</span><br><span class="line">    mainloop()</span><br></pre></td></tr></table></figure>

<p><img src="https://img.imgdb.cn/item/6012bddc3ffa7d37b3eb0db5.png" alt="哆啦A梦"></p>
<h1 id="皮卡丘"><a href="#皮卡丘" class="headerlink" title="皮卡丘"></a>皮卡丘</h1><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> turtle <span class="keyword">as</span> t</span><br><span class="line"><span class="keyword">import</span> time</span><br><span class="line"><span class="comment"># 皮卡丘</span></span><br><span class="line"><span class="comment"># 基础设置</span></span><br><span class="line">t.screensize(<span class="number">800</span>, <span class="number">600</span>)</span><br><span class="line">t.pensize(<span class="number">2</span>)  <span class="comment"># 设置画笔的大小</span></span><br><span class="line">t.speed(<span class="number">10</span>)  <span class="comment"># 设置画笔速度为10</span></span><br><span class="line"><span class="comment"># 画左偏曲线函数</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">radian_left</span>(<span class="params">ang, dis, step, n</span>):</span></span><br><span class="line">    <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(n):</span><br><span class="line">        dis += step  <span class="comment"># dis增大step</span></span><br><span class="line">        t.lt(ang)  <span class="comment"># 向左转ang度</span></span><br><span class="line">        t.fd(dis)  <span class="comment"># 向前走dis的步长</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">radian_right</span>(<span class="params">ang, dis, step, n</span>):</span></span><br><span class="line">    <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(n):</span><br><span class="line">        dis += step</span><br><span class="line">        t.rt(ang)  <span class="comment"># 向左转ang度</span></span><br><span class="line">        t.fd(dis)  <span class="comment"># 向前走dis的步长</span></span><br><span class="line"><span class="comment"># 画耳朵</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">InitEars</span>():</span></span><br><span class="line">    t.color(<span class="string">&quot;black&quot;</span>, <span class="string">&quot;yellow&quot;</span>)</span><br><span class="line">    <span class="comment"># 左耳朵曲线</span></span><br><span class="line">    t.pu()  <span class="comment"># 提笔</span></span><br><span class="line">    t.goto(-<span class="number">50</span>, <span class="number">100</span>)  <span class="comment"># 笔头初始位置</span></span><br><span class="line">    t.pd()  <span class="comment"># 下笔</span></span><br><span class="line">    t.setheading(<span class="number">110</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.begin_fill()</span><br><span class="line">    radian_left(<span class="number">1.2</span>, <span class="number">0.4</span>, <span class="number">0.1</span>, <span class="number">40</span>)</span><br><span class="line">    t.setheading(<span class="number">270</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    radian_left(<span class="number">1.2</span>, <span class="number">0.4</span>, <span class="number">0.1</span>, <span class="number">40</span>)</span><br><span class="line">    t.setheading(<span class="number">44</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">32</span>)</span><br><span class="line">    t.end_fill()</span><br><span class="line">    <span class="comment"># 右耳朵曲线</span></span><br><span class="line">    t.pu()  <span class="comment"># 提笔</span></span><br><span class="line">    t.goto(<span class="number">50</span>, <span class="number">100</span>)  <span class="comment"># 笔头初始位置</span></span><br><span class="line">    t.pd()  <span class="comment"># 下笔</span></span><br><span class="line">    t.setheading(<span class="number">70</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.begin_fill()</span><br><span class="line">    radian_right(<span class="number">1.2</span>, <span class="number">0.4</span>, <span class="number">0.1</span>, <span class="number">40</span>)</span><br><span class="line">    t.setheading(<span class="number">270</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    radian_right(<span class="number">1.2</span>, <span class="number">0.4</span>, <span class="number">0.1</span>, <span class="number">40</span>)</span><br><span class="line">    t.setheading(<span class="number">136</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">32</span>)</span><br><span class="line">    t.end_fill()</span><br><span class="line">    <span class="comment"># 耳朵黑</span></span><br><span class="line">    t.begin_fill()</span><br><span class="line">    t.fillcolor(<span class="string">&quot;black&quot;</span>)</span><br><span class="line">    t.pu()  <span class="comment"># 提笔</span></span><br><span class="line">    t.goto(<span class="number">88</span>, <span class="number">141</span>)  <span class="comment"># 笔头初始位置</span></span><br><span class="line">    t.pd()  <span class="comment"># 下笔</span></span><br><span class="line">    t.setheading(<span class="number">35</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    radian_right(<span class="number">1.2</span>, <span class="number">1.6</span>, <span class="number">0.1</span>, <span class="number">16</span>)</span><br><span class="line">    t.setheading(<span class="number">270</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    radian_right(<span class="number">1.2</span>, <span class="number">0.4</span>, <span class="number">0.1</span>, <span class="number">25</span>)</span><br><span class="line">    t.setheading(<span class="number">132</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">31</span>)</span><br><span class="line">    t.end_fill()</span><br><span class="line">    t.begin_fill()</span><br><span class="line">    t.fillcolor(<span class="string">&quot;black&quot;</span>)</span><br><span class="line">    t.pu()  <span class="comment"># 提笔</span></span><br><span class="line">    t.goto(-<span class="number">88</span>, <span class="number">141</span>)  <span class="comment"># 笔头初始位置</span></span><br><span class="line">    t.pd()  <span class="comment"># 下笔</span></span><br><span class="line">    t.setheading(<span class="number">145</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    radian_left(<span class="number">1.2</span>, <span class="number">1.6</span>, <span class="number">0.1</span>, <span class="number">16</span>)</span><br><span class="line">    t.setheading(<span class="number">270</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    radian_left(<span class="number">1.2</span>, <span class="number">0.4</span>, <span class="number">0.1</span>, <span class="number">25</span>)</span><br><span class="line">    t.setheading(<span class="number">48</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">31</span>)</span><br><span class="line">    t.end_fill()</span><br><span class="line"><span class="comment"># 画尾巴</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">InitTail</span>():</span></span><br><span class="line">    <span class="comment"># 尾巴</span></span><br><span class="line">    t.begin_fill()</span><br><span class="line">    t.fillcolor(<span class="string">&quot;yellow&quot;</span>)</span><br><span class="line">    t.pu()  <span class="comment"># 提笔</span></span><br><span class="line">    t.goto(<span class="number">64</span>, -<span class="number">140</span>)  <span class="comment"># 笔头初始位置</span></span><br><span class="line">    t.pd()  <span class="comment"># 下笔</span></span><br><span class="line">    t.setheading(<span class="number">10</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">20</span>)</span><br><span class="line">    t.setheading(<span class="number">90</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">20</span>)</span><br><span class="line">    t.setheading(<span class="number">10</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">10</span>)</span><br><span class="line">    t.setheading(<span class="number">80</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">100</span>)</span><br><span class="line">    t.setheading(<span class="number">35</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">80</span>)</span><br><span class="line">    t.setheading(<span class="number">260</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">100</span>)</span><br><span class="line">    t.setheading(<span class="number">205</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">40</span>)</span><br><span class="line">    t.setheading(<span class="number">260</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">37</span>)</span><br><span class="line">    t.setheading(<span class="number">205</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">20</span>)</span><br><span class="line">    t.setheading(<span class="number">260</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">25</span>)</span><br><span class="line">    t.setheading(<span class="number">175</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">30</span>)</span><br><span class="line">    t.setheading(<span class="number">100</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">13</span>)</span><br><span class="line">    t.end_fill()</span><br><span class="line"><span class="comment"># 画脚</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">InitFoots</span>():</span></span><br><span class="line">    <span class="comment"># 脚</span></span><br><span class="line">    t.begin_fill()</span><br><span class="line">    t.fillcolor(<span class="string">&quot;yellow&quot;</span>)</span><br><span class="line">    t.pensize(<span class="number">2</span>)</span><br><span class="line">    t.pu()  <span class="comment"># 提笔</span></span><br><span class="line">    t.goto(-<span class="number">70</span>, -<span class="number">200</span>)  <span class="comment"># 笔头初始位置</span></span><br><span class="line">    t.pd()  <span class="comment"># 下笔</span></span><br><span class="line">    t.setheading(<span class="number">225</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    radian_left(<span class="number">0.5</span>, <span class="number">1.2</span>, <span class="number">0</span>, <span class="number">12</span>)</span><br><span class="line">    radian_left(<span class="number">35</span>, <span class="number">0.6</span>, <span class="number">0</span>, <span class="number">4</span>)</span><br><span class="line">    radian_left(<span class="number">1</span>, <span class="number">1.2</span>, <span class="number">0</span>, <span class="number">18</span>)</span><br><span class="line">    t.setheading(<span class="number">160</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">13</span>)</span><br><span class="line">    t.end_fill()</span><br><span class="line">    t.begin_fill()</span><br><span class="line">    t.fillcolor(<span class="string">&quot;yellow&quot;</span>)</span><br><span class="line">    t.pensize(<span class="number">2</span>)</span><br><span class="line">    t.pu()  <span class="comment"># 提笔</span></span><br><span class="line">    t.goto(<span class="number">70</span>, -<span class="number">200</span>)  <span class="comment"># 笔头初始位置</span></span><br><span class="line">    t.pd()  <span class="comment"># 下笔</span></span><br><span class="line">    t.setheading(<span class="number">315</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    radian_right(<span class="number">0.5</span>, <span class="number">1.2</span>, <span class="number">0</span>, <span class="number">12</span>)</span><br><span class="line">    radian_right(<span class="number">35</span>, <span class="number">0.6</span>, <span class="number">0</span>, <span class="number">4</span>)</span><br><span class="line">    radian_right(<span class="number">1</span>, <span class="number">1.2</span>, <span class="number">0</span>, <span class="number">18</span>)</span><br><span class="line">    t.setheading(<span class="number">20</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">13</span>)</span><br><span class="line">    t.end_fill()</span><br><span class="line"><span class="comment"># 画身体</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">InitBody</span>():</span></span><br><span class="line">    <span class="comment"># 外形轮廓</span></span><br><span class="line">    t.begin_fill()</span><br><span class="line">    t.pu()  <span class="comment"># 提笔</span></span><br><span class="line">    t.goto(<span class="number">112</span>, <span class="number">0</span>)  <span class="comment"># 笔头初始位置</span></span><br><span class="line">    t.pd()  <span class="comment"># 下笔</span></span><br><span class="line">    t.setheading(<span class="number">90</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.circle(<span class="number">112</span>, <span class="number">180</span>)</span><br><span class="line">    t.setheading(<span class="number">250</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    radian_left(<span class="number">1.6</span>, <span class="number">1.3</span>, <span class="number">0</span>, <span class="number">50</span>)</span><br><span class="line">    radian_left(<span class="number">0.8</span>, <span class="number">1.5</span>, <span class="number">0</span>, <span class="number">25</span>)</span><br><span class="line">    t.setheading(<span class="number">255</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    radian_left(<span class="number">0.4</span>, <span class="number">1.6</span>, <span class="number">0.2</span>, <span class="number">27</span>)</span><br><span class="line">    radian_left(<span class="number">2.8</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">45</span>)</span><br><span class="line">    radian_right(<span class="number">0.9</span>, <span class="number">1.4</span>, <span class="number">0</span>, <span class="number">31</span>)</span><br><span class="line">    t.setheading(<span class="number">355</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    radian_right(<span class="number">0.9</span>, <span class="number">1.4</span>, <span class="number">0</span>, <span class="number">31</span>)</span><br><span class="line">    radian_left(<span class="number">2.8</span>, <span class="number">1</span>, <span class="number">0</span>, <span class="number">45</span>)</span><br><span class="line">    radian_left(<span class="number">0.4</span>, <span class="number">7.2</span>, -<span class="number">0.2</span>, <span class="number">27</span>)</span><br><span class="line">    t.setheading(<span class="number">10</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    radian_left(<span class="number">0.8</span>, <span class="number">1.5</span>, <span class="number">0</span>, <span class="number">25</span>)</span><br><span class="line">    radian_left(<span class="number">1.6</span>, <span class="number">1.3</span>, <span class="number">0</span>, <span class="number">50</span>)</span><br><span class="line">    t.end_fill()</span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">InitEyes</span>():</span></span><br><span class="line">    <span class="comment"># 左眼睛</span></span><br><span class="line">    t.begin_fill()</span><br><span class="line">    t.fillcolor(<span class="string">&quot;black&quot;</span>)</span><br><span class="line">    t.pu()  <span class="comment"># 提笔</span></span><br><span class="line">    t.goto(-<span class="number">46</span>, <span class="number">10</span>)  <span class="comment"># 笔头初始位置</span></span><br><span class="line">    t.pd()  <span class="comment"># 下笔</span></span><br><span class="line">    t.setheading(<span class="number">90</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.circle(<span class="number">5</span>, <span class="number">360</span>)</span><br><span class="line">    t.end_fill()</span><br><span class="line">    <span class="comment"># 右眼睛</span></span><br><span class="line">    t.begin_fill()</span><br><span class="line">    t.fillcolor(<span class="string">&quot;black&quot;</span>)</span><br><span class="line">    t.pu()  <span class="comment"># 提笔</span></span><br><span class="line">    t.goto(<span class="number">46</span>, <span class="number">10</span>)  <span class="comment"># 笔头初始位置</span></span><br><span class="line">    t.pd()  <span class="comment"># 下笔</span></span><br><span class="line">    t.setheading(-<span class="number">90</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.circle(<span class="number">5</span>, <span class="number">360</span>)</span><br><span class="line">    t.end_fill()</span><br><span class="line"><span class="comment"># 画脸</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">InitFace</span>():</span></span><br><span class="line">    <span class="comment"># 脸蛋</span></span><br><span class="line">    t.begin_fill()</span><br><span class="line">    t.fillcolor(<span class="string">&quot;red&quot;</span>)</span><br><span class="line">    t.pu()  <span class="comment"># 提笔</span></span><br><span class="line">    t.goto(-<span class="number">63</span>, -<span class="number">10</span>)  <span class="comment"># 笔头初始位置</span></span><br><span class="line">    t.pd()  <span class="comment"># 下笔</span></span><br><span class="line">    t.setheading(<span class="number">90</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.circle(<span class="number">10</span>, <span class="number">360</span>)</span><br><span class="line">    t.end_fill()</span><br><span class="line">    t.begin_fill()</span><br><span class="line">    t.fillcolor(<span class="string">&quot;red&quot;</span>)</span><br><span class="line">    t.pu()  <span class="comment"># 提笔</span></span><br><span class="line">    t.goto(<span class="number">63</span>, -<span class="number">10</span>)  <span class="comment"># 笔头初始位置</span></span><br><span class="line">    t.pd()  <span class="comment"># 下笔</span></span><br><span class="line">    t.setheading(-<span class="number">90</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.circle(<span class="number">10</span>, <span class="number">360</span>)</span><br><span class="line">    t.end_fill()</span><br><span class="line">    <span class="comment"># 嘴巴</span></span><br><span class="line">    t.pensize(<span class="number">2.2</span>)</span><br><span class="line">    t.pu()  <span class="comment"># 提笔</span></span><br><span class="line">    t.goto(<span class="number">0</span>, <span class="number">0</span>)  <span class="comment"># 笔头初始位置</span></span><br><span class="line">    t.pd()  <span class="comment"># 下笔</span></span><br><span class="line">    t.setheading(<span class="number">235</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    radian_right(<span class="number">5</span>, <span class="number">0.8</span>, <span class="number">0</span>, <span class="number">30</span>)</span><br><span class="line">    t.pu()  <span class="comment"># 提笔</span></span><br><span class="line">    t.goto(<span class="number">0</span>, <span class="number">0</span>)  <span class="comment"># 笔头初始位置</span></span><br><span class="line">    t.pd()  <span class="comment"># 下笔</span></span><br><span class="line">    t.setheading(<span class="number">305</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    radian_left(<span class="number">5</span>, <span class="number">0.8</span>, <span class="number">0</span>, <span class="number">30</span>)</span><br><span class="line"><span class="comment"># 画手</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">InitHands</span>():</span></span><br><span class="line">    <span class="comment"># 左手</span></span><br><span class="line">    t.pensize(<span class="number">2</span>)</span><br><span class="line">    t.pu()  <span class="comment"># 提笔</span></span><br><span class="line">    t.goto(-<span class="number">46</span>, -<span class="number">100</span>)  <span class="comment"># 笔头初始位置</span></span><br><span class="line">    t.pd()  <span class="comment"># 下笔</span></span><br><span class="line">    t.setheading(<span class="number">285</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    radian_right(<span class="number">0.4</span>, <span class="number">1.2</span>, <span class="number">0</span>, <span class="number">26</span>)</span><br><span class="line">    radian_right(<span class="number">5</span>, <span class="number">0.35</span>, <span class="number">0</span>, <span class="number">26</span>)</span><br><span class="line">    radian_right(<span class="number">0.3</span>, <span class="number">1.2</span>, <span class="number">0</span>, <span class="number">15</span>)</span><br><span class="line">    <span class="comment"># 右手</span></span><br><span class="line">    t.pu()  <span class="comment"># 提笔</span></span><br><span class="line">    t.goto(<span class="number">46</span>, -<span class="number">100</span>)  <span class="comment"># 笔头初始位置</span></span><br><span class="line">    t.pd()  <span class="comment"># 下笔</span></span><br><span class="line">    t.setheading(<span class="number">255</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    radian_left(<span class="number">0.4</span>, <span class="number">1.2</span>, <span class="number">0</span>, <span class="number">26</span>)</span><br><span class="line">    radian_left(<span class="number">5</span>, <span class="number">0.35</span>, <span class="number">0</span>, <span class="number">26</span>)</span><br><span class="line">    radian_left(<span class="number">0.3</span>, <span class="number">1.2</span>, <span class="number">0</span>, <span class="number">15</span>)</span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">CloseEyes</span>():</span></span><br><span class="line">    <span class="comment"># 左眼睛</span></span><br><span class="line">    t.pu()  <span class="comment"># 提笔</span></span><br><span class="line">    t.goto(-<span class="number">46</span>, <span class="number">12</span>)  <span class="comment"># 笔头初始位置</span></span><br><span class="line">    t.pd()  <span class="comment"># 下笔</span></span><br><span class="line">    t.setheading(<span class="number">180</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">10</span>)</span><br><span class="line">    <span class="comment"># 右眼睛</span></span><br><span class="line">    t.pu()  <span class="comment"># 提笔</span></span><br><span class="line">    t.goto(<span class="number">46</span>, <span class="number">12</span>)  <span class="comment"># 笔头初始位置</span></span><br><span class="line">    t.pd()  <span class="comment"># 下笔</span></span><br><span class="line">    t.setheading(<span class="number">0</span>)  <span class="comment"># 画笔角度</span></span><br><span class="line">    t.forward(<span class="number">10</span>)</span><br><span class="line"><span class="comment"># 初始化</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">Init</span>():</span></span><br><span class="line">    InitEars()</span><br><span class="line">    InitTail()</span><br><span class="line">    InitFoots()</span><br><span class="line">    InitBody()</span><br><span class="line">    InitFace()</span><br><span class="line">    InitHands()</span><br><span class="line">    InitEyes()</span><br><span class="line"><span class="comment"># 眨眼睛</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">Upgarde</span>():</span></span><br><span class="line">    InitEars()</span><br><span class="line">    InitTail()</span><br><span class="line">    InitFoots()</span><br><span class="line">    InitBody()</span><br><span class="line">    InitFace()</span><br><span class="line">    InitHands()</span><br><span class="line">    CloseEyes()</span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">Upgarde_Init</span>():</span></span><br><span class="line">    InitEars()</span><br><span class="line">    InitTail()</span><br><span class="line">    InitFoots()</span><br><span class="line">    InitBody()</span><br><span class="line">    InitFace()</span><br><span class="line">    InitHands()</span><br><span class="line">    InitEyes()</span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">main</span>():</span></span><br><span class="line">    Init()</span><br><span class="line">    t.tracer(<span class="literal">False</span>)</span><br><span class="line">    <span class="comment"># 眨眼睛动画</span></span><br><span class="line">    <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">30</span>):</span><br><span class="line">        <span class="keyword">if</span> i % <span class="number">2</span> == <span class="number">0</span>:</span><br><span class="line">            t.reset()</span><br><span class="line">            t.hideturtle()</span><br><span class="line">            Upgarde()</span><br><span class="line">            t.update()</span><br><span class="line">            time.sleep(<span class="number">0.3</span>)</span><br><span class="line">        <span class="keyword">else</span>:</span><br><span class="line">            t.reset()</span><br><span class="line">            t.hideturtle()</span><br><span class="line">            Upgarde_Init()</span><br><span class="line">            t.update()</span><br><span class="line">            time.sleep(<span class="number">1</span>)</span><br><span class="line">main()</span><br><span class="line"><span class="comment"># 结束画笔</span></span><br></pre></td></tr></table></figure>

<p><img src="https://img.imgdb.cn/item/6012bddc3ffa7d37b3eb0db8.png" alt="皮卡丘"></p>
<h1 id="捂脸表情"><a href="#捂脸表情" class="headerlink" title="捂脸表情"></a>捂脸表情</h1><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> turtle</span><br><span class="line"></span><br><span class="line"><span class="comment"># 画指定的任意圆弧</span></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">arc</span>(<span class="params">sa, ea, x, y, r</span>):</span>  <span class="comment"># start angle,end angle,circle center,radius</span></span><br><span class="line">    turtle.penup()</span><br><span class="line">    turtle.goto(x, y)</span><br><span class="line">    turtle.setheading(<span class="number">0</span>)</span><br><span class="line">    turtle.left(sa)</span><br><span class="line">    turtle.fd(r)</span><br><span class="line">    turtle.pendown()</span><br><span class="line">    turtle.left(<span class="number">90</span>)</span><br><span class="line">    turtle.circle(r, (ea - sa))</span><br><span class="line">    <span class="keyword">return</span> turtle.position()</span><br><span class="line">turtle.hideturtle()</span><br><span class="line"></span><br><span class="line"><span class="comment"># 画脸</span></span><br><span class="line">turtle.speed(<span class="number">5</span>)</span><br><span class="line">turtle.setup(<span class="number">900</span>, <span class="number">600</span>, <span class="number">200</span>, <span class="number">200</span>)</span><br><span class="line">turtle.pensize(<span class="number">5</span>)</span><br><span class="line">turtle.right(<span class="number">90</span>)</span><br><span class="line">turtle.penup()</span><br><span class="line">turtle.fd(<span class="number">100</span>)</span><br><span class="line">turtle.left(<span class="number">90</span>)</span><br><span class="line">turtle.pendown()</span><br><span class="line">turtle.begin_fill()</span><br><span class="line">turtle.pencolor(<span class="string">&quot;#B26A0F&quot;</span>)  <span class="comment"># head side color</span></span><br><span class="line">turtle.circle(<span class="number">150</span>)</span><br><span class="line">turtle.fillcolor(<span class="string">&quot;#F9E549&quot;</span>)  <span class="comment"># face color</span></span><br><span class="line">turtle.end_fill()</span><br><span class="line"></span><br><span class="line"><span class="comment"># 画嘴</span></span><br><span class="line">turtle.penup()</span><br><span class="line">turtle.goto(<span class="number">77</span>, <span class="number">20</span>)</span><br><span class="line">turtle.pencolor(<span class="string">&quot;#744702&quot;</span>)</span><br><span class="line">turtle.goto(<span class="number">0</span>, <span class="number">50</span>)</span><br><span class="line">turtle.right(<span class="number">30</span>)</span><br><span class="line">turtle.fd(<span class="number">110</span>)</span><br><span class="line">turtle.right(<span class="number">90</span>)</span><br><span class="line">turtle.pendown()</span><br><span class="line">turtle.begin_fill()</span><br><span class="line">turtle.fillcolor(<span class="string">&quot;#925902&quot;</span>)  <span class="comment"># mouth color</span></span><br><span class="line">turtle.circle(-<span class="number">97</span>, <span class="number">160</span>)</span><br><span class="line">turtle.goto(<span class="number">92</span>, -<span class="number">3</span>)</span><br><span class="line">turtle.end_fill()</span><br><span class="line">turtle.penup()</span><br><span class="line">turtle.goto(<span class="number">77</span>, -<span class="number">25</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># 画牙齿</span></span><br><span class="line">turtle.pencolor(<span class="string">&quot;white&quot;</span>)</span><br><span class="line">turtle.begin_fill()</span><br><span class="line">turtle.fillcolor(<span class="string">&quot;white&quot;</span>)</span><br><span class="line">turtle.goto(<span class="number">77</span>, -<span class="number">24</span>)</span><br><span class="line">turtle.goto(-<span class="number">81</span>, <span class="number">29</span>)</span><br><span class="line">turtle.goto(-<span class="number">70</span>, <span class="number">43</span>)</span><br><span class="line">turtle.goto(<span class="number">77</span>, -<span class="number">8</span>)</span><br><span class="line">turtle.end_fill()</span><br><span class="line">turtle.penup()</span><br><span class="line">turtle.goto(<span class="number">0</span>, -<span class="number">100</span>)</span><br><span class="line">turtle.setheading(<span class="number">0</span>)</span><br><span class="line">turtle.pendown()</span><br><span class="line"></span><br><span class="line"><span class="comment"># 画左边眼泪</span></span><br><span class="line">turtle.left(<span class="number">90</span>)</span><br><span class="line">turtle.penup()</span><br><span class="line">turtle.fd(<span class="number">150</span>)</span><br><span class="line">turtle.right(<span class="number">60</span>)</span><br><span class="line">turtle.fd(-<span class="number">150</span>)</span><br><span class="line">turtle.pendown()</span><br><span class="line">turtle.left(<span class="number">20</span>)</span><br><span class="line">turtle.pencolor(<span class="string">&quot;#155F84&quot;</span>)  <span class="comment"># tear side color</span></span><br><span class="line">turtle.fd(<span class="number">150</span>)</span><br><span class="line">turtle.right(<span class="number">180</span>)</span><br><span class="line">position1 = turtle.position()</span><br><span class="line">turtle.begin_fill()</span><br><span class="line">turtle.fillcolor(<span class="string">&quot;#7EB0C8&quot;</span>)  <span class="comment"># tear color</span></span><br><span class="line">turtle.fd(<span class="number">150</span>)</span><br><span class="line">turtle.right(<span class="number">20</span>)</span><br><span class="line">turtle.left(<span class="number">270</span>)</span><br><span class="line">turtle.circle(-<span class="number">150</span>, <span class="number">18</span>)</span><br><span class="line">turtle.right(<span class="number">52</span>)</span><br><span class="line">turtle.fd(<span class="number">110</span>)</span><br><span class="line">position2 = turtle.position()</span><br><span class="line">turtle.goto(-<span class="number">33</span>, <span class="number">90</span>)</span><br><span class="line">turtle.end_fill()</span><br><span class="line"></span><br><span class="line"><span class="comment"># 画右边眼泪</span></span><br><span class="line">turtle.penup()</span><br><span class="line">turtle.goto(<span class="number">0</span>, <span class="number">0</span>)</span><br><span class="line">turtle.setheading(<span class="number">0</span>)</span><br><span class="line">turtle.left(<span class="number">90</span>)</span><br><span class="line">turtle.fd(<span class="number">50</span>)</span><br><span class="line">turtle.right(<span class="number">150</span>)</span><br><span class="line">turtle.fd(<span class="number">150</span>)</span><br><span class="line">turtle.left(<span class="number">150</span>)</span><br><span class="line">turtle.fd(<span class="number">100</span>)</span><br><span class="line">turtle.pendown()</span><br><span class="line">turtle.begin_fill()</span><br><span class="line">turtle.fd(-<span class="number">100</span>)</span><br><span class="line">turtle.fillcolor(<span class="string">&quot;#7EB0C8&quot;</span>)  <span class="comment"># tear color</span></span><br><span class="line">turtle.right(<span class="number">60</span>)</span><br><span class="line">turtle.circle(<span class="number">150</span>, <span class="number">15</span>)</span><br><span class="line">turtle.left(<span class="number">45</span>)</span><br><span class="line">turtle.fd(<span class="number">66</span>)</span><br><span class="line">turtle.goto(<span class="number">77</span>, <span class="number">20</span>)</span><br><span class="line">turtle.end_fill()</span><br><span class="line"></span><br><span class="line"><span class="comment"># 画眼睛</span></span><br><span class="line">turtle.penup()</span><br><span class="line">turtle.pencolor(<span class="string">&quot;#6C4E00&quot;</span>)  <span class="comment"># eye color</span></span><br><span class="line">turtle.goto(-<span class="number">65</span>, <span class="number">75</span>)</span><br><span class="line">turtle.setheading(<span class="number">0</span>)</span><br><span class="line">turtle.left(<span class="number">27</span>)</span><br><span class="line">turtle.fd(<span class="number">38</span>)</span><br><span class="line">turtle.pendown()</span><br><span class="line">turtle.begin_fill()</span><br><span class="line">turtle.fillcolor(<span class="string">&quot;#6C4E00&quot;</span>)  <span class="comment"># eye color</span></span><br><span class="line">turtle.left(<span class="number">90</span>)</span><br><span class="line">turtle.circle(<span class="number">38</span>, <span class="number">86</span>)</span><br><span class="line">turtle.goto(position2[<span class="number">0</span>], position2[<span class="number">1</span>])</span><br><span class="line">turtle.goto(position1[<span class="number">0</span>], position1[<span class="number">1</span>])</span><br><span class="line">turtle.end_fill()</span><br><span class="line"></span><br><span class="line"><span class="comment"># 画手</span></span><br><span class="line">turtle.pencolor(<span class="string">&quot;#D57E18&quot;</span>)  <span class="comment"># hand side color</span></span><br><span class="line">turtle.begin_fill()</span><br><span class="line">turtle.fillcolor(<span class="string">&quot;#EFBD3D&quot;</span>)  <span class="comment"># hand color</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># 第一个手指</span></span><br><span class="line">arc(-<span class="number">110</span>, <span class="number">10</span>, <span class="number">110</span>, -<span class="number">40</span>, <span class="number">30</span>)</span><br><span class="line">turtle.circle(<span class="number">300</span>, <span class="number">35</span>)</span><br><span class="line">turtle.circle(<span class="number">13</span>, <span class="number">120</span>)</span><br><span class="line">turtle.setheading(-<span class="number">50</span>)</span><br><span class="line">turtle.fd(<span class="number">20</span>)</span><br><span class="line">turtle.setheading(<span class="number">130</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># 第二个手指</span></span><br><span class="line">turtle.circle(<span class="number">200</span>, <span class="number">15</span>)</span><br><span class="line">turtle.circle(<span class="number">12</span>, <span class="number">180</span>)</span><br><span class="line">turtle.fd(<span class="number">40</span>)</span><br><span class="line">turtle.setheading(<span class="number">137</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># 第三个手指</span></span><br><span class="line">turtle.circle(<span class="number">200</span>, <span class="number">16</span>)</span><br><span class="line">turtle.circle(<span class="number">12</span>, <span class="number">160</span>)</span><br><span class="line">turtle.setheading(-<span class="number">35</span>)</span><br><span class="line">turtle.fd(<span class="number">45</span>)</span><br><span class="line">turtle.setheading(<span class="number">140</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># 第四个手指</span></span><br><span class="line">turtle.circle(<span class="number">200</span>, <span class="number">13</span>)</span><br><span class="line">turtle.circle(<span class="number">11</span>, <span class="number">160</span>)</span><br><span class="line">turtle.setheading(-<span class="number">35</span>)</span><br><span class="line">turtle.fd(<span class="number">40</span>)</span><br><span class="line">turtle.setheading(<span class="number">145</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># 第五个手指</span></span><br><span class="line">turtle.circle(<span class="number">200</span>, <span class="number">9</span>)</span><br><span class="line">turtle.circle(<span class="number">10</span>, <span class="number">180</span>)</span><br><span class="line">turtle.setheading(-<span class="number">31</span>)</span><br><span class="line">turtle.fd(<span class="number">50</span>)</span><br><span class="line"></span><br><span class="line"><span class="comment"># 画最后手腕的部分</span></span><br><span class="line">turtle.setheading(-<span class="number">45</span>)</span><br><span class="line">turtle.pensize(<span class="number">7</span>)</span><br><span class="line">turtle.right(<span class="number">5</span>)</span><br><span class="line">turtle.circle(<span class="number">180</span>, <span class="number">35</span>)</span><br><span class="line">turtle.end_fill()</span><br><span class="line">turtle.begin_fill()</span><br><span class="line">turtle.setheading(-<span class="number">77</span>)</span><br><span class="line">turtle.pensize(<span class="number">5</span>)</span><br><span class="line">turtle.fd(<span class="number">50</span>)</span><br><span class="line">turtle.left(-<span class="number">270</span>)</span><br><span class="line">turtle.fd(<span class="number">7</span>)</span><br><span class="line">turtle.pencolor(<span class="string">&quot;#EFBD3D&quot;</span>)</span><br><span class="line">turtle.circle(<span class="number">30</span>, <span class="number">180</span>)</span><br><span class="line">turtle.end_fill()</span><br><span class="line"></span><br><span class="line"><span class="comment"># 测试</span></span><br><span class="line"><span class="comment"># res=arc(70,220,90,50,300)</span></span><br><span class="line"><span class="comment"># print(res[0],res[1])</span></span><br><span class="line">turtle.done()</span><br></pre></td></tr></table></figure>

<p><img src="https://img.imgdb.cn/item/6012bddc3ffa7d37b3eb0dc1.png" alt="捂脸表情"></p>
<h1 id="小猪佩奇"><a href="#小猪佩奇" class="headerlink" title="小猪佩奇"></a>小猪佩奇</h1><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br><span class="line">166</span><br><span class="line">167</span><br><span class="line">168</span><br><span class="line">169</span><br><span class="line">170</span><br><span class="line">171</span><br><span class="line">172</span><br><span class="line">173</span><br><span class="line">174</span><br><span class="line">175</span><br><span class="line">176</span><br><span class="line">177</span><br><span class="line">178</span><br><span class="line">179</span><br><span class="line">180</span><br><span class="line">181</span><br><span class="line">182</span><br><span class="line">183</span><br><span class="line">184</span><br><span class="line">185</span><br><span class="line">186</span><br><span class="line">187</span><br><span class="line">188</span><br><span class="line">189</span><br><span class="line">190</span><br><span class="line">191</span><br><span class="line">192</span><br><span class="line">193</span><br><span class="line">194</span><br><span class="line">195</span><br><span class="line">196</span><br><span class="line">197</span><br><span class="line">198</span><br><span class="line">199</span><br><span class="line">200</span><br><span class="line">201</span><br><span class="line">202</span><br><span class="line">203</span><br><span class="line">204</span><br><span class="line">205</span><br><span class="line">206</span><br><span class="line">207</span><br><span class="line">208</span><br><span class="line">209</span><br><span class="line">210</span><br><span class="line">211</span><br><span class="line">212</span><br><span class="line">213</span><br><span class="line">214</span><br><span class="line">215</span><br><span class="line">216</span><br><span class="line">217</span><br><span class="line">218</span><br><span class="line">219</span><br><span class="line">220</span><br><span class="line">221</span><br><span class="line">222</span><br><span class="line">223</span><br><span class="line">224</span><br><span class="line">225</span><br><span class="line">226</span><br><span class="line">227</span><br><span class="line">228</span><br><span class="line">229</span><br><span class="line">230</span><br><span class="line">231</span><br><span class="line">232</span><br><span class="line">233</span><br><span class="line">234</span><br><span class="line">235</span><br><span class="line">236</span><br><span class="line">237</span><br><span class="line">238</span><br><span class="line">239</span><br><span class="line">240</span><br><span class="line">241</span><br><span class="line">242</span><br><span class="line">243</span><br><span class="line">244</span><br><span class="line">245</span><br><span class="line">246</span><br><span class="line">247</span><br><span class="line">248</span><br><span class="line">249</span><br><span class="line">250</span><br><span class="line">251</span><br><span class="line">252</span><br><span class="line">253</span><br><span class="line">254</span><br><span class="line">255</span><br><span class="line">256</span><br><span class="line">257</span><br><span class="line">258</span><br><span class="line">259</span><br><span class="line">260</span><br><span class="line">261</span><br><span class="line">262</span><br><span class="line">263</span><br><span class="line">264</span><br><span class="line">265</span><br><span class="line">266</span><br><span class="line">267</span><br><span class="line">268</span><br><span class="line">269</span><br><span class="line">270</span><br><span class="line">271</span><br><span class="line">272</span><br><span class="line">273</span><br><span class="line">274</span><br><span class="line">275</span><br><span class="line">276</span><br><span class="line">277</span><br><span class="line">278</span><br><span class="line">279</span><br><span class="line">280</span><br><span class="line">281</span><br><span class="line">282</span><br><span class="line">283</span><br><span class="line">284</span><br><span class="line">285</span><br><span class="line">286</span><br><span class="line">287</span><br><span class="line">288</span><br><span class="line">289</span><br><span class="line">290</span><br><span class="line">291</span><br><span class="line">292</span><br><span class="line">293</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> turtle <span class="keyword">import</span> *</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">nose</span>(<span class="params">x, y</span>):</span>  <span class="comment"># 鼻子</span></span><br><span class="line">    penup()  <span class="comment"># 提起笔</span></span><br><span class="line">    goto(x, y)  <span class="comment"># 定位</span></span><br><span class="line">    pendown()  <span class="comment"># 落笔，开始画</span></span><br><span class="line">    setheading(-<span class="number">30</span>)  <span class="comment"># 将乌龟的方向设置为to_angle/为数字（0-东、90-北、180-西、270-南）</span></span><br><span class="line">    begin_fill()  <span class="comment"># 准备开始填充图形</span></span><br><span class="line">    a = <span class="number">0.4</span></span><br><span class="line">    <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">120</span>):</span><br><span class="line">        <span class="keyword">if</span> <span class="number">0</span> &lt;= i &lt; <span class="number">30</span> <span class="keyword">or</span> <span class="number">60</span> &lt;= i &lt; <span class="number">90</span>:</span><br><span class="line">            a = a + <span class="number">0.08</span></span><br><span class="line">            left(<span class="number">3</span>)  <span class="comment"># 向左转3度</span></span><br><span class="line">            forward(a)  <span class="comment"># 向前走a的步长</span></span><br><span class="line">        <span class="keyword">else</span>:</span><br><span class="line">            a = a - <span class="number">0.08</span></span><br><span class="line">            left(<span class="number">3</span>)</span><br><span class="line">            forward(a)</span><br><span class="line">    end_fill()  <span class="comment"># 填充完成</span></span><br><span class="line"></span><br><span class="line">    penup()</span><br><span class="line">    setheading(<span class="number">90</span>)</span><br><span class="line">    forward(<span class="number">25</span>)</span><br><span class="line">    setheading(<span class="number">0</span>)</span><br><span class="line">    forward(<span class="number">10</span>)</span><br><span class="line">    pendown()</span><br><span class="line">    pencolor(<span class="number">255</span>, <span class="number">155</span>, <span class="number">192</span>)  <span class="comment"># 画笔颜色</span></span><br><span class="line">    setheading(<span class="number">10</span>)</span><br><span class="line">    begin_fill()</span><br><span class="line">    circle(<span class="number">5</span>)</span><br><span class="line">    color(<span class="number">160</span>, <span class="number">82</span>, <span class="number">45</span>)  <span class="comment"># 返回或设置pencolor和fillcolor</span></span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line">    penup()</span><br><span class="line">    setheading(<span class="number">0</span>)</span><br><span class="line">    forward(<span class="number">20</span>)</span><br><span class="line">    pendown()</span><br><span class="line">    pencolor(<span class="number">255</span>, <span class="number">155</span>, <span class="number">192</span>)</span><br><span class="line">    setheading(<span class="number">10</span>)</span><br><span class="line">    begin_fill()</span><br><span class="line">    circle(<span class="number">5</span>)</span><br><span class="line">    color(<span class="number">160</span>, <span class="number">82</span>, <span class="number">45</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">head</span>(<span class="params">x, y</span>):</span>  <span class="comment"># 头</span></span><br><span class="line">    color((<span class="number">255</span>, <span class="number">155</span>, <span class="number">192</span>), <span class="string">&quot;pink&quot;</span>)</span><br><span class="line">    penup()</span><br><span class="line">    goto(x, y)</span><br><span class="line">    setheading(<span class="number">0</span>)</span><br><span class="line">    pendown()</span><br><span class="line">    begin_fill()</span><br><span class="line">    setheading(<span class="number">180</span>)</span><br><span class="line">    circle(<span class="number">300</span>, -<span class="number">30</span>)</span><br><span class="line">    circle(<span class="number">100</span>, -<span class="number">60</span>)</span><br><span class="line">    circle(<span class="number">80</span>, -<span class="number">100</span>)</span><br><span class="line">    circle(<span class="number">150</span>, -<span class="number">20</span>)</span><br><span class="line">    circle(<span class="number">60</span>, -<span class="number">95</span>)</span><br><span class="line">    setheading(<span class="number">161</span>)</span><br><span class="line">    circle(-<span class="number">300</span>, <span class="number">15</span>)</span><br><span class="line">    penup()</span><br><span class="line">    goto(-<span class="number">100</span>, <span class="number">100</span>)</span><br><span class="line">    pendown()</span><br><span class="line">    setheading(-<span class="number">30</span>)</span><br><span class="line">    a = <span class="number">0.4</span></span><br><span class="line">    <span class="keyword">for</span> i <span class="keyword">in</span> <span class="built_in">range</span>(<span class="number">60</span>):</span><br><span class="line">        <span class="keyword">if</span> <span class="number">0</span> &lt;= i &lt; <span class="number">30</span> <span class="keyword">or</span> <span class="number">60</span> &lt;= i &lt; <span class="number">90</span>:</span><br><span class="line">            a = a + <span class="number">0.08</span></span><br><span class="line">            lt(<span class="number">3</span>)  <span class="comment"># 向左转3度</span></span><br><span class="line">            fd(a)  <span class="comment"># 向前走a的步长</span></span><br><span class="line">        <span class="keyword">else</span>:</span><br><span class="line">            a = a - <span class="number">0.08</span></span><br><span class="line">            lt(<span class="number">3</span>)</span><br><span class="line">            fd(a)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">ears</span>(<span class="params">x, y</span>):</span>  <span class="comment"># 耳朵</span></span><br><span class="line">    color((<span class="number">255</span>, <span class="number">155</span>, <span class="number">192</span>), <span class="string">&quot;pink&quot;</span>)</span><br><span class="line">    penup()</span><br><span class="line">    goto(x, y)</span><br><span class="line">    pendown()</span><br><span class="line">    begin_fill()</span><br><span class="line">    setheading(<span class="number">100</span>)</span><br><span class="line">    circle(-<span class="number">50</span>, <span class="number">50</span>)</span><br><span class="line">    circle(-<span class="number">10</span>, <span class="number">120</span>)</span><br><span class="line">    circle(-<span class="number">50</span>, <span class="number">54</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line">    penup()</span><br><span class="line">    setheading(<span class="number">90</span>)</span><br><span class="line">    forward(-<span class="number">12</span>)</span><br><span class="line">    setheading(<span class="number">0</span>)</span><br><span class="line">    forward(<span class="number">30</span>)</span><br><span class="line">    pendown()</span><br><span class="line">    begin_fill()</span><br><span class="line">    setheading(<span class="number">100</span>)</span><br><span class="line">    circle(-<span class="number">50</span>, <span class="number">50</span>)</span><br><span class="line">    circle(-<span class="number">10</span>, <span class="number">120</span>)</span><br><span class="line">    circle(-<span class="number">50</span>, <span class="number">56</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">eyes</span>(<span class="params">x, y</span>):</span>  <span class="comment"># 眼睛</span></span><br><span class="line">    color((<span class="number">255</span>, <span class="number">155</span>, <span class="number">192</span>), <span class="string">&quot;white&quot;</span>)</span><br><span class="line">    penup()</span><br><span class="line">    setheading(<span class="number">90</span>)</span><br><span class="line">    forward(-<span class="number">20</span>)</span><br><span class="line">    setheading(<span class="number">0</span>)</span><br><span class="line">    forward(-<span class="number">95</span>)</span><br><span class="line">    pendown()</span><br><span class="line">    begin_fill()</span><br><span class="line">    circle(<span class="number">15</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line">    color(<span class="string">&quot;black&quot;</span>)</span><br><span class="line">    penup()</span><br><span class="line">    setheading(<span class="number">90</span>)</span><br><span class="line">    forward(<span class="number">12</span>)</span><br><span class="line">    setheading(<span class="number">0</span>)</span><br><span class="line">    forward(-<span class="number">3</span>)</span><br><span class="line">    pendown()</span><br><span class="line">    begin_fill()</span><br><span class="line">    circle(<span class="number">3</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line">    color((<span class="number">255</span>, <span class="number">155</span>, <span class="number">192</span>), <span class="string">&quot;white&quot;</span>)</span><br><span class="line">    penup()</span><br><span class="line">    seth(<span class="number">90</span>)</span><br><span class="line">    forward(-<span class="number">25</span>)</span><br><span class="line">    seth(<span class="number">0</span>)</span><br><span class="line">    forward(<span class="number">40</span>)</span><br><span class="line">    pendown()</span><br><span class="line">    begin_fill()</span><br><span class="line">    circle(<span class="number">15</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line">    color(<span class="string">&quot;black&quot;</span>)</span><br><span class="line">    penup()</span><br><span class="line">    setheading(<span class="number">90</span>)</span><br><span class="line">    forward(<span class="number">12</span>)</span><br><span class="line">    setheading(<span class="number">0</span>)</span><br><span class="line">    forward(-<span class="number">3</span>)</span><br><span class="line">    pendown()</span><br><span class="line">    begin_fill()</span><br><span class="line">    circle(<span class="number">3</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">cheek</span>(<span class="params">x, y</span>):</span>  <span class="comment"># 腮</span></span><br><span class="line">    color((<span class="number">255</span>, <span class="number">155</span>, <span class="number">192</span>))</span><br><span class="line">    penup()</span><br><span class="line">    goto(x, y)</span><br><span class="line">    pendown()</span><br><span class="line">    setheading(<span class="number">0</span>)</span><br><span class="line">    begin_fill()</span><br><span class="line">    circle(<span class="number">30</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">mouth</span>(<span class="params">x, y</span>):</span>  <span class="comment"># 嘴</span></span><br><span class="line">    color(<span class="number">239</span>, <span class="number">69</span>, <span class="number">19</span>)</span><br><span class="line">    penup()</span><br><span class="line">    goto(x, y)</span><br><span class="line">    pendown()</span><br><span class="line">    setheading(-<span class="number">80</span>)</span><br><span class="line">    circle(<span class="number">30</span>, <span class="number">40</span>)</span><br><span class="line">    circle(<span class="number">40</span>, <span class="number">80</span>)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">body</span>(<span class="params">x, y</span>):</span>  <span class="comment"># 身体</span></span><br><span class="line">    color(<span class="string">&quot;red&quot;</span>, (<span class="number">255</span>, <span class="number">99</span>, <span class="number">71</span>))</span><br><span class="line">    penup()</span><br><span class="line">    goto(x, y)</span><br><span class="line">    pendown()</span><br><span class="line">    begin_fill()</span><br><span class="line">    setheading(-<span class="number">130</span>)</span><br><span class="line">    circle(<span class="number">100</span>, <span class="number">10</span>)</span><br><span class="line">    circle(<span class="number">300</span>, <span class="number">30</span>)</span><br><span class="line">    setheading(<span class="number">0</span>)</span><br><span class="line">    forward(<span class="number">230</span>)</span><br><span class="line">    setheading(<span class="number">90</span>)</span><br><span class="line">    circle(<span class="number">300</span>, <span class="number">30</span>)</span><br><span class="line">    circle(<span class="number">100</span>, <span class="number">3</span>)</span><br><span class="line">    color((<span class="number">255</span>, <span class="number">155</span>, <span class="number">192</span>), (<span class="number">255</span>, <span class="number">100</span>, <span class="number">100</span>))</span><br><span class="line">    setheading(-<span class="number">135</span>)</span><br><span class="line">    circle(-<span class="number">80</span>, <span class="number">63</span>)</span><br><span class="line">    circle(-<span class="number">150</span>, <span class="number">24</span>)</span><br><span class="line">    end_fill()</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">hands</span>(<span class="params">x, y</span>):</span>  <span class="comment"># 手</span></span><br><span class="line">    color((<span class="number">255</span>, <span class="number">155</span>, <span class="number">192</span>))</span><br><span class="line">    penup()</span><br><span class="line">    goto(x, y)</span><br><span class="line">    pendown()</span><br><span class="line">    setheading(-<span class="number">160</span>)</span><br><span class="line">    circle(<span class="number">300</span>, <span class="number">15</span>)</span><br><span class="line">    penup()</span><br><span class="line">    setheading(<span class="number">90</span>)</span><br><span class="line">    forward(<span class="number">15</span>)</span><br><span class="line">    setheading(<span class="number">0</span>)</span><br><span class="line">    forward(<span class="number">0</span>)</span><br><span class="line">    pendown()</span><br><span class="line">    setheading(-<span class="number">10</span>)</span><br><span class="line">    circle(-<span class="number">20</span>, <span class="number">90</span>)</span><br><span class="line"></span><br><span class="line">    penup()</span><br><span class="line">    setheading(<span class="number">90</span>)</span><br><span class="line">    forward(<span class="number">30</span>)</span><br><span class="line">    setheading(<span class="number">0</span>)</span><br><span class="line">    forward(<span class="number">237</span>)</span><br><span class="line">    pendown()</span><br><span class="line">    setheading(-<span class="number">20</span>)</span><br><span class="line">    circle(-<span class="number">300</span>, <span class="number">15</span>)</span><br><span class="line">    penup()</span><br><span class="line">    setheading(<span class="number">90</span>)</span><br><span class="line">    forward(<span class="number">20</span>)</span><br><span class="line">    setheading(<span class="number">0</span>)</span><br><span class="line">    forward(<span class="number">0</span>)</span><br><span class="line">    pendown()</span><br><span class="line">    setheading(-<span class="number">170</span>)</span><br><span class="line">    circle(<span class="number">20</span>, <span class="number">90</span>)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">foot</span>(<span class="params">x, y</span>):</span>  <span class="comment"># 脚</span></span><br><span class="line">    pensize(<span class="number">10</span>)</span><br><span class="line">    color((<span class="number">240</span>, <span class="number">128</span>, <span class="number">128</span>))</span><br><span class="line">    penup()</span><br><span class="line">    goto(x, y)</span><br><span class="line">    pendown()</span><br><span class="line">    setheading(-<span class="number">90</span>)</span><br><span class="line">    forward(<span class="number">40</span>)</span><br><span class="line">    setheading(-<span class="number">180</span>)</span><br><span class="line">    color(<span class="string">&quot;black&quot;</span>)</span><br><span class="line">    pensize(<span class="number">15</span>)</span><br><span class="line">    fd(<span class="number">20</span>)</span><br><span class="line"></span><br><span class="line">    pensize(<span class="number">10</span>)</span><br><span class="line">    color((<span class="number">240</span>, <span class="number">128</span>, <span class="number">128</span>))</span><br><span class="line">    penup()</span><br><span class="line">    setheading(<span class="number">90</span>)</span><br><span class="line">    forward(<span class="number">40</span>)</span><br><span class="line">    setheading(<span class="number">0</span>)</span><br><span class="line">    forward(<span class="number">90</span>)</span><br><span class="line">    pendown()</span><br><span class="line">    setheading(-<span class="number">90</span>)</span><br><span class="line">    forward(<span class="number">40</span>)</span><br><span class="line">    setheading(-<span class="number">180</span>)</span><br><span class="line">    color(<span class="string">&quot;black&quot;</span>)</span><br><span class="line">    pensize(<span class="number">15</span>)</span><br><span class="line">    fd(<span class="number">20</span>)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">tail</span>(<span class="params">x, y</span>):</span>  <span class="comment"># 尾巴</span></span><br><span class="line">    pensize(<span class="number">4</span>)</span><br><span class="line">    color((<span class="number">255</span>, <span class="number">155</span>, <span class="number">192</span>))</span><br><span class="line">    penup()</span><br><span class="line">    goto(x, y)</span><br><span class="line">    pendown()</span><br><span class="line">    seth(<span class="number">0</span>)</span><br><span class="line">    circle(<span class="number">70</span>, <span class="number">20</span>)</span><br><span class="line">    circle(<span class="number">10</span>, <span class="number">330</span>)</span><br><span class="line">    circle(<span class="number">70</span>, <span class="number">30</span>)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">setting</span>():</span>  <span class="comment"># 参数设置</span></span><br><span class="line">    pensize(<span class="number">4</span>)</span><br><span class="line">    hideturtle()  <span class="comment"># 使乌龟无形（隐藏）</span></span><br><span class="line">    colormode(<span class="number">255</span>)  <span class="comment"># 将其设置为1.0或255.随后 颜色三元组的r，g，b值必须在0 .. cmode范围内</span></span><br><span class="line">    color((<span class="number">255</span>, <span class="number">155</span>, <span class="number">192</span>), <span class="string">&quot;pink&quot;</span>)</span><br><span class="line">    setup(<span class="number">840</span>, <span class="number">500</span>)</span><br><span class="line">    speed(<span class="number">10</span>)</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">def</span> <span class="title">main</span>():</span></span><br><span class="line">    setting()  <span class="comment"># 画布、画笔设置</span></span><br><span class="line">    nose(-<span class="number">100</span>, <span class="number">100</span>)  <span class="comment"># 鼻子</span></span><br><span class="line">    head(-<span class="number">69</span>, <span class="number">167</span>)  <span class="comment"># 头</span></span><br><span class="line">    ears(<span class="number">0</span>, <span class="number">160</span>)  <span class="comment"># 耳朵</span></span><br><span class="line">    eyes(<span class="number">0</span>, <span class="number">140</span>)  <span class="comment"># 眼睛</span></span><br><span class="line">    cheek(<span class="number">80</span>, <span class="number">10</span>)  <span class="comment"># 腮</span></span><br><span class="line">    mouth(-<span class="number">20</span>, <span class="number">30</span>)  <span class="comment"># 嘴</span></span><br><span class="line">    body(-<span class="number">32</span>, -<span class="number">8</span>)  <span class="comment"># 身体</span></span><br><span class="line">    hands(-<span class="number">56</span>, -<span class="number">45</span>)  <span class="comment"># 手</span></span><br><span class="line">    foot(<span class="number">2</span>, -<span class="number">177</span>)  <span class="comment"># 脚</span></span><br><span class="line">    tail(<span class="number">148</span>, -<span class="number">155</span>)  <span class="comment"># 尾巴</span></span><br><span class="line">    done()</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">if</span> __name__ == <span class="string">&#x27;__main__&#x27;</span>:</span><br><span class="line">    main()</span><br></pre></td></tr></table></figure>

<p><img src="https://img.imgdb.cn/item/6012bddc3ffa7d37b3eb0dca.png" alt="小猪佩奇"></p>
</article><div class="post-copyright"><div class="post-copyright__title"><span class="post-copyright-info"><h>Python成品：运用turtle模块绘画</h></span></div><div class="post-copyright__type"><span class="post-copyright-info"><a href="http://amnesia-f.github.io/posts/7c82/">http://amnesia-f.github.io/posts/7c82/</a></span></div><div class="post-copyright-m"><div class="post-copyright-m-info"><div class="post-copyright-a"><h>作者</h><div class="post-copyright-cc-info"><h>Amnesia</h></div></div><div class="post-copyright-c"><h>发布于</h><div class="post-copyright-cc-info"><h>2021-01-28</h></div></div><div class="post-copyright-u"><h>更新于</h><div class="post-copyright-cc-info"><h>2021-01-28</h></div></div><div class="post-copyright-c"><h>许可协议</h><div class="post-copyright-cc-info"><a class="icon" rel="noopener" target="_blank" title="Creative Commons" href="https://creativecommons.org/"><i class="fab fa-creative-commons"></i></a><a rel="noopener" target="_blank" title="CC BY-NC-SA 4.0" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a></div></div></div></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/Python/">Python</a><a class="post-meta__tags" href="/tags/%E6%88%90%E5%93%81/">成品</a><a class="post-meta__tags" href="/tags/turtle%E6%A8%A1%E5%9D%97/">turtle模块</a></div><div class="post_share"><div class="social-share" data-image="https://img.imgdb.cn/item/6012b60e3ffa7d37b3e66e13.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/posts/b7ed/"><img class="prev-cover" src="https://img.imgdb.cn/item/601377b03ffa7d37b32b44ac.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">Pycharm激活至2099年方法</div></div></a></div><div class="next-post pull-right"><a href="/posts/ad79/"><img class="next-cover" src="https://img.imgdb.cn/item/6010e64f3ffa7d37b3f3a563.jpg" onerror="onerror=null;src='/img/404.jpg'" alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">Python学习笔记：函数</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/posts/7594/" title="Python学习笔记：字典"><img class="cover" src="https://img.imgdb.cn/item/6010e64f3ffa7d37b3f3a563.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-01-27</div><div class="title">Python学习笔记：字典</div></div></a></div><div><a href="/posts/ac2c/" title="Python学习笔记：列表和元组"><img class="cover" src="https://img.imgdb.cn/item/6010e64f3ffa7d37b3f3a563.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-01-26</div><div class="title">Python学习笔记：列表和元组</div></div></a></div><div><a href="/posts/ad79/" title="Python学习笔记：函数"><img class="cover" src="https://img.imgdb.cn/item/6010e64f3ffa7d37b3f3a563.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-01-28</div><div class="title">Python学习笔记：函数</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="twikoo-wrap"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/avatar.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Amnesia</div><div class="author-info__description">零碎的岛屿总会找到海.</div></div><div class="card-info-data is-center"><div class="card-info-data-item"><a href="/archives/"><div class="headline">文章</div><div class="length-num">57</div></a></div><div class="card-info-data-item"><a href="/tags/"><div class="headline">标签</div><div class="length-num">44</div></a></div><div class="card-info-data-item"><a href="/categories/"><div class="headline">分类</div><div class="length-num">19</div></a></div></div><a id="card-info-btn" target="_blank" rel="noopener" href="https://amnesia-f.gitee.io/"><i class="fab fa-github"></i><span>国内镜像站</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/Amnesia-f" target="_blank" title="Github"><i class="iconfont  iconGitHub"></i></a><a class="social-icon" href="https://twitter.com/Amnesia79047925" target="_blank" title="Twitter"><i class="iconfont  icontwitter1"></i></a><a class="social-icon" href="mailto:f3586454827@gmail.com" target="_blank" title="Mail"><i class="iconfont  iconemail"></i></a><a class="social-icon" href="https://amnesia-f.github.io/rss2.xml" target="_blank" title="RSS"><i class="iconfont  iconrss"></i></a><a class="social-icon" href="https://space.bilibili.com/552857266" target="_blank" title="Bilibili"><i class="iconfont  iconbilibili-line"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">因不可抗力的因素，原博客文件丢失，<br/> 且学业繁忙，断更数月有余。<br/> 特乘寒假之日，对博客重新部署，<br/> 原有文章已悉数找回，保留了原有博客主题。<br/> 预计在2月10日前，恢复博客运行。<br/> 祝大家虎年虎虎生威，新春快乐！<br/> 欢迎访问我的<a href="https://amnesia-f.github.io/">Github主页</a>！<br/> <br/>          By Amnesia on 29th January 2022.<br/> <img src="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/Yay.gif"><br/></div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#Turtle%E6%A8%A1%E5%9D%97%E7%9A%84%E5%87%BD%E6%95%B0"><span class="toc-number">1.</span> <span class="toc-text">Turtle模块的函数</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#1-%E7%94%BB%E7%AC%94%E7%A7%BB%E5%8A%A8%E5%87%BD%E6%95%B0"><span class="toc-number">1.0.1.</span> <span class="toc-text">1.画笔移动函数</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-%E7%94%BB%E7%AC%94%E6%8E%A7%E5%88%B6%E5%87%BD%E6%95%B0"><span class="toc-number">1.0.2.</span> <span class="toc-text">2.画笔控制函数</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-%E5%85%A8%E5%B1%80%E6%8E%A7%E5%88%B6%E5%87%BD%E6%95%B0"><span class="toc-number">1.0.3.</span> <span class="toc-text">3.全局控制函数</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E7%88%B1%E5%BF%83"><span class="toc-number">2.</span> <span class="toc-text">爱心</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%93%86%E5%95%A6A%E6%A2%A6"><span class="toc-number">3.</span> <span class="toc-text">哆啦A梦</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E7%9A%AE%E5%8D%A1%E4%B8%98"><span class="toc-number">4.</span> <span class="toc-text">皮卡丘</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E6%8D%82%E8%84%B8%E8%A1%A8%E6%83%85"><span class="toc-number">5.</span> <span class="toc-text">捂脸表情</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%B0%8F%E7%8C%AA%E4%BD%A9%E5%A5%87"><span class="toc-number">6.</span> <span class="toc-text">小猪佩奇</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/posts/k210/" title="使用Mx_Yolo_v3训练K210模型文件"><img src="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/post/使用Mx_Yolo_v3训练K210模型文件/封面.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="使用Mx_Yolo_v3训练K210模型文件"/></a><div class="content"><a class="title" href="/posts/k210/" title="使用Mx_Yolo_v3训练K210模型文件">使用Mx_Yolo_v3训练K210模型文件</a><time datetime="2022-04-29T16:45:14.782Z" title="发表于 2022-04-30 00:45:14">2022-04-30</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/ce04/" title="无视限制升级安装Windows11"><img src="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/post/无视限制升级安装Windows11/cover.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="无视限制升级安装Windows11"/></a><div class="content"><a class="title" href="/posts/ce04/" title="无视限制升级安装Windows11">无视限制升级安装Windows11</a><time datetime="2022-04-17T12:47:35.000Z" title="发表于 2022-04-17 20:47:35">2022-04-17</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/6ec6/" title="为AppInventor添加在线更新功能"><img src="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/post/为AppInventor添加在线更新功能/封面.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="为AppInventor添加在线更新功能"/></a><div class="content"><a class="title" href="/posts/6ec6/" title="为AppInventor添加在线更新功能">为AppInventor添加在线更新功能</a><time datetime="2022-02-27T09:30:58.000Z" title="发表于 2022-02-27 17:30:58">2022-02-27</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/m762/" title="基于物联网的师生呼叫系统"><img src="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/post/基于物联网的师生呼叫系统/cover.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="基于物联网的师生呼叫系统"/></a><div class="content"><a class="title" href="/posts/m762/" title="基于物联网的师生呼叫系统">基于物联网的师生呼叫系统</a><time datetime="2022-02-04T09:30:58.000Z" title="发表于 2022-02-04 17:30:58">2022-02-04</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/4e5b/" title="Hexo博客美化日记 || Amnesia's Blog"><img src="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/post/Hexo博客美化日记/封面.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Hexo博客美化日记 || Amnesia's Blog"/></a><div class="content"><a class="title" href="/posts/4e5b/" title="Hexo博客美化日记 || Amnesia's Blog">Hexo博客美化日记 || Amnesia's Blog</a><time datetime="2022-02-03T02:36:34.531Z" title="发表于 2022-02-03 10:36:34">2022-02-03</time></div></div></div></div></div></div></main><footer id="footer" style="background: -webkit-linear-gradient( 0deg, rgba(247, 149, 51, 0.1) 0, rgba(243, 112, 85, 0.1) 15%, rgba(239, 78, 123, 0.1) 30%, rgba(161, 102, 171, 0.1) 44%, rgba(80, 115, 184, 0.1) 58%, rgba(16, 152, 173, 0.1) 72%, rgba(7, 179, 155, 0.1) 86%, rgba(109, 186, 130, 0.1) 100% )"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2022  <i id="heartbeat" class="fa fas fa-heartbeat"></i> Amnesia</div><div id="running-time"></div><div class="footer_custom_text"><p><a style="margin-inline:5px" target="_blank" href="https://hexo.io/"><img src="https://img.shields.io/badge/Frame-Hexo-blue?style=flat&logo=hexo" title="博客框架为Hexo"></a><a style="margin-inline:5px" target="_blank" href="https://butterfly.js.org/"><img src="https://img.shields.io/badge/Theme-Butterfly-6513df?style=flat&logo=bitdefender" title="主题采用Butterfly"></a><a style="margin-inline:5px" target="_blank" href="https://www.jsdelivr.com/"><img src="https://img.shields.io/badge/CDN-jsDelivr-orange?style=flat&logo=jsDelivr" title="本站使用JsDelivr为静态资源提供CDN加速"></a><a style="margin-inline:5px" target="_blank" href="https://vercel.com/ "><img src="https://img.shields.io/badge/Hosted-Vervel-brightgreen?style=flat&logo=Vercel" title="本站采用双线部署，默认线路托管于Vercel"></a><a style="margin-inline:5px" target="_blank" href="https://gitee.com/ "><img src="https://img.shields.io/badge/Hosted-Gitee-0cedbe?style=flat&logo=Gitee" title="本站采用双线部署，国内镜像托管于Gitee"></a><a style="margin-inline:5px" target="_blank" href="https://github.com/"><img src="https://img.shields.io/badge/Source-Github-d021d6?style=flat&logo=GitHub" title="本站项目由Gtihub托管"></a><a style="margin-inline:5px" target="_blank" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img src="https://img.shields.io/badge/Copyright-BY--NC--SA%204.0-d42328?style=flat&logo=Claris" title="本站采用知识共享署名-非商业性使用-相同方式共享4.0国际许可协议进行许可"></a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">本地搜索</span><span id="loading-status"></span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="is-center" id="loading-database"><i class="fas fa-spinner fa-pulse"></i><span>  数据库加载中</span></div><div class="search-wrap"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div><hr/><div id="local-search-results"></div></div></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.js"></script><script src="https://cdn.jsdelivr.net/npm/node-snackbar/dist/snackbar.min.js"></script><script>function panguFn () {
  if (typeof pangu === 'object') pangu.autoSpacingPage()
  else {
    getScript('https://cdn.jsdelivr.net/npm/pangu/dist/browser/pangu.min.js')
      .then(() => {
        pangu.autoSpacingPage()
      })
  }
}

function panguInit () {
  if (false){
    GLOBAL_CONFIG_SITE.isPost && panguFn()
  } else {
    panguFn()
  }
}

document.addEventListener('DOMContentLoaded', panguInit)</script><script src="/js/search/local-search.js"></script><div class="js-pjax"><script>(()=>{
  const init = () => {
    twikoo.init(Object.assign({
      el: '#twikoo-wrap',
      envId: 'https://twikoo-comment-teal.vercel.app/',
      region: '',
      onCommentLoaded: function () {
        btf.loadLightbox(document.querySelectorAll('#twikoo .tk-content img:not(.vemoji)'))
      }
    }, null))
  }

  const getCount = () => {
    twikoo.getCommentsCount({
      envId: 'https://twikoo-comment-teal.vercel.app/',
      region: '',
      urls: [window.location.pathname],
      includeReply: false
    }).then(function (res) {
      document.getElementById('twikoo-count').innerText = res[0].count
    }).catch(function (err) {
      console.error(err);
    });
  }

  const runFn = () => {
    init()
    GLOBAL_CONFIG_SITE.isPost && getCount()
  }

  const loadTwikoo = () => {
    if (typeof twikoo === 'object') {
      setTimeout(runFn,0)
      return
    } 
    getScript('https://cdn.jsdelivr.net/npm/twikoo/dist/twikoo.all.min.js').then(runFn)
  }

  if ('Twikoo' === 'Twikoo' || !false) {
    if (false) btf.loadComment(document.getElementById('twikoo-wrap'), loadTwikoo)
    else loadTwikoo()
  } else {
    window.loadOtherComment = () => {
      loadTwikoo()
    }
  }
})()</script></div><script defer src="https://cdn.jsdelivr.net/gh/graingert/wow@1.3.0/dist/wow.min.js"></script><script defer data-pjax src="/js/wow_init.js"></script><script>setInterval(()=>{let create_time=Math.round(new Date("2021-1-20-10:36:38").getTime()/1000);let timestamp=Math.round((new Date().getTime()+8*60*60*1000)/1000);let second=timestamp-create_time;let time=new Array(0,0,0,0,0);if(second>=365*24*3600){time[0]=parseInt(second/(365*24*3600));second%=365*24*3600}if(second>=24*3600){time[1]=parseInt(second/(24*3600));second%=24*3600}if(second>=3600){time[2]=parseInt(second/3600);second%=3600}if(second>=60){time[3]=parseInt(second/60);second%=60}if(second>0){time[4]=second}currentTimeHtml='小破站已经安全运行 '+time[0]+' 年 '+time[1]+' 天 '+time[2]+' 时 '+time[3]+' 分 '+time[4]+' 秒';var elementById=document.getElementById('running-time');if(elementById){elementById.innerHTML=currentTimeHtml}},1000);</script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js"></script><script src="https://cdn.jsdelivr.net/npm/pjax/pjax.min.js"></script><script>let pjaxSelectors = ["title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show",".js-pjax"]

var pjax = new Pjax({
  elements: 'a:not([target="_blank"])',
  selectors: pjaxSelectors,
  cacheBust: false,
  analytics: true,
  scrollRestoration: false
})

document.addEventListener('pjax:send', function () {

  // removeEventListener scroll 
  window.tocScrollFn && window.removeEventListener('scroll', window.tocScrollFn)
  window.scrollCollect && window.removeEventListener('scroll', scrollCollect)

  typeof preloader === 'object' && preloader.initLoading()
  document.getElementById('rightside').style.cssText = "opacity: ''; transform: ''"
  
  if (window.aplayers) {
    for (let i = 0; i < window.aplayers.length; i++) {
      if (!window.aplayers[i].options.fixed) {
        window.aplayers[i].destroy()
      }
    }
  }

  typeof typed === 'object' && typed.destroy()

  //reset readmode
  const $bodyClassList = document.body.classList
  $bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')

})

document.addEventListener('pjax:complete', function () {
  window.refreshFn()

  document.querySelectorAll('script[data-pjax]').forEach(item => {
    const newScript = document.createElement('script')
    const content = item.text || item.textContent || item.innerHTML || ""
    Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
    newScript.appendChild(document.createTextNode(content))
    item.parentNode.replaceChild(newScript, item)
  })

  GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()

  typeof chatBtnFn === 'function' && chatBtnFn()
  typeof panguInit === 'function' && panguInit()

  // google analytics
  typeof gtag === 'function' && gtag('config', 'UA-172938598-1', {'page_path': window.location.pathname});

  // baidu analytics
  typeof _hmt === 'object' && _hmt.push(['_trackPageview',window.location.pathname]);

  typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()

  // prismjs
  typeof Prism === 'object' && Prism.highlightAll()

  typeof preloader === 'object' && preloader.endLoading()
})

document.addEventListener('pjax:error', (e) => {
  if (e.request.status === 404) {
    pjax.loadUrl('/404.html')
  }
})</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><!-- hexo injector body_end start -->
  <script data-pjax src="https://cdn.jsdelivr.net/gh/Zfour/hexo-github-calendar@1.21/hexo_githubcalendar.js"></script>
  <script data-pjax>
        function GithubCalendarConfig(){
            var git_githubapiurl ="https://python-github-calendar-api-eight.vercel.app/api/?Amnesia-f?Amnesia-f";
            var git_color =['#ebedf0', '#fdcdec', '#fc9bd9', '#fa6ac5', '#f838b2', '#f5089f', '#c4067e', '#92055e', '#540336', '#48022f', '#30021f'];
            var git_user ="Amnesia-f";
            var parent_div_git = document.getElementById('recent-posts');
            var git_div_html = '<div class="recent-post-item" style="width:100%;height:auto;padding:10px;"><div id="github_loading" style="width:10%;height:100%;margin:0 auto;display: block"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"  viewBox="0 0 50 50" style="enable-background:new 0 0 50 50" xml:space="preserve"><path fill="#d0d0d0" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z" transform="rotate(275.098 25 25)"><animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"></animateTransform></path></svg></div><div id="github_container"></div></div>';
            if(parent_div_git && location.pathname =='/'){
                console.log('已挂载github calendar')
                // parent_div_git.innerHTML=git_div_html+parent_div_git.innerHTML // 无报错，但不影响使用(支持pjax跳转)
                parent_div_git.insertAdjacentHTML("afterbegin",git_div_html) // 有报错，但不影响使用(支持pjax跳转)
            };
            GithubCalendar(git_githubapiurl,git_color,git_user)
        }
        if(document.getElementById('recent-posts')){
            GithubCalendarConfig()
        }
    </script>
    <style>#github_container{min-height:280px}@media screen and (max-width:650px) {#github_container{background-image:;min-height:0px}}</style>
    <style></style> <script data-pjax>if(document.getElementById('recent-posts') && location.pathname =='/'){
    
    var parent = document.getElementById('recent-posts');
    var child = '<div class="recent-post-item" style="height: auto;width: 100%"><div class="blog-slider swiper-container-fade swiper-container-horizontal" id="swiper_container"><div class="blog-slider__wrp swiper-wrapper" style="transition-duration: 0ms"><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms"><div class="blog-slider__img"><img src="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/post/Hexo搭建个人博客：从开始到放弃/hexo.jpg" alt="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/post/Hexo搭建个人博客：从开始到放弃/hexo.jpg"/></div><div class="blog-slider__content"><span class="blog-slider__code">2021-01-21</span><a class="blog-slider__title" href="posts/aea2/">Hexo搭建个人博客：从开始到放弃</a><div class="blog-slider__text">非常友好的小白向教程，详细介绍了搭建Hexo博客的步骤。</div><a class="blog-slider__button" href="posts/aea2/">详情</a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms"><div class="blog-slider__img"><img src="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/post/部署Twikoo评论系统及其邮件推送(Vercel)/封面.png" alt="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/post/部署Twikoo评论系统及其邮件推送(Vercel)/封面.png"/></div><div class="blog-slider__content"><span class="blog-slider__code">2022-02-01</span><a class="blog-slider__title" href="posts/8b3/">部署Twikoo评论系统及其邮件推送(Vercel)</a><div class="blog-slider__text">详细介绍了使用Vercel+MongoDB方案搭建Twikoo评论系统的过程，并实现邮件自动通知回复信息。</div><a class="blog-slider__button" href="posts/8b3/">详情</a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms"><div class="blog-slider__img"><img src="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/post/阿里云IoT：控制掌控板板载灯亮灭/封面.png" alt="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/post/阿里云IoT：控制掌控板板载灯亮灭/封面.png"/></div><div class="blog-slider__content"><span class="blog-slider__code">2021-02-07</span><a class="blog-slider__title" href="posts/c232/">阿里云IoT：控制掌控板板载灯亮灭</a><div class="blog-slider__text">使用阿里云IoT+App+掌控板的方式控制灯光的亮灭，其中涉及到阿里云物联网平台以及MQTT协议的介绍。</div><a class="blog-slider__button" href="posts/c232/">详情</a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms"><div class="blog-slider__img"><img src="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/post/Day8：一款无线抢答系统的实现过程/cover.jpg" alt="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/post/Day8：一款无线抢答系统的实现过程/cover.jpg"/></div><div class="blog-slider__content"><span class="blog-slider__code">2021-08-08</span><a class="blog-slider__title" href="posts/d9a3/">Day8：一款无线抢答系统的实现过程</a><div class="blog-slider__text">基于LoRa+蓝牙+掌控板+AppInventor方案实现的一款无线抢答系统，通过手机App下达答题命令到裁判端，再由裁判端分发命令并捕捉抢答信息。</div><a class="blog-slider__button" href="posts/d9a3/">详情</a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms"><div class="blog-slider__img"><img src="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/post/Hexo博客技巧：利用JsDeliver加速文件/封面.jpg" alt="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/post/Hexo博客技巧：利用JsDeliver加速文件/封面.jpg"/></div><div class="blog-slider__content"><span class="blog-slider__code">2021-02-10</span><a class="blog-slider__title" href="posts/20b3/">Hexo博客技巧：利用JsDeliver加速文件</a><div class="blog-slider__text">利用GitHub+JsDeliver搭建CDN图床，加快Hexo博客的加载速度，同时还能减少担心图片挂掉的后顾之忧。</div><a class="blog-slider__button" href="posts/20b3/">详情</a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms"><div class="blog-slider__img"><img src="https://pic.imgdb.cn/item/61f639662ab3f51d916ed633.png" alt="https://pic.imgdb.cn/item/61f639662ab3f51d916ed633.png"/></div><div class="blog-slider__content"><span class="blog-slider__code">2021-07-15</span><a class="blog-slider__title" href="posts/77049f2e/">Day4：蓝牙4.0与5.0模块的使用</a><div class="blog-slider__text">详细介绍了蓝牙4.0与5.0模块的使用，文章中提供了配置、指令、引脚等大量资料。</div><a class="blog-slider__button" href="posts/77049f2e/">详情</a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms"><div class="blog-slider__img"><img src="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/post/%E8%AE%BA%E5%AF%86%E7%A0%81%E7%AE%A1%E7%90%86/%E5%B0%81%E9%9D%A2.png" alt="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/post/%E8%AE%BA%E5%AF%86%E7%A0%81%E7%AE%A1%E7%90%86/%E5%B0%81%E9%9D%A2.png"/></div><div class="blog-slider__content"><span class="blog-slider__code">2021-03-01</span><a class="blog-slider__title" href="posts/6746a1c3/">论密码管理</a><div class="blog-slider__text">免费，开源，离线化的密码管理方案。</div><a class="blog-slider__button" href="posts/6746a1c3/">详情</a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms"><div class="blog-slider__img"><img src="https://img.imgdb.cn/item/6028903bd2a061fec7b181f3.png" alt="https://img.imgdb.cn/item/6028903bd2a061fec7b181f3.png"/></div><div class="blog-slider__content"><span class="blog-slider__code">2021-02-15</span><a class="blog-slider__title" href="posts/461b0433/">掌控板在上传模式下无法连接MQTT的解决方法</a><div class="blog-slider__text">如题，掌控板在上传模式下无法连接MQTT的解决方法(SIoT)。</div><a class="blog-slider__button" href="posts/461b0433/">详情</a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms"><div class="blog-slider__img"><img src="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/post/QuickLook%EF%BC%9A%E8%83%BD%E6%8C%89%E4%B8%80%E4%B8%8B%E7%A9%BA%E6%A0%BC%E4%B8%BA%E4%BB%80%E4%B9%88%E8%A6%81%E6%8C%89%E4%B8%A4%E4%B8%8B%E9%BC%A0%E6%A0%87/%E5%B0%81%E9%9D%A2.png" alt="https://cdn.jsdelivr.net/gh/Amnesia-f/jsDelivr_CDN/post/QuickLook%EF%BC%9A%E8%83%BD%E6%8C%89%E4%B8%80%E4%B8%8B%E7%A9%BA%E6%A0%BC%E4%B8%BA%E4%BB%80%E4%B9%88%E8%A6%81%E6%8C%89%E4%B8%A4%E4%B8%8B%E9%BC%A0%E6%A0%87/%E5%B0%81%E9%9D%A2.png"/></div><div class="blog-slider__content"><span class="blog-slider__code">2021-03-04</span><a class="blog-slider__title" href="posts/adf6e4b/">QuickLook：能按一下空格为什么要按两下鼠标</a><div class="blog-slider__text">QuickLook是一款开源、免费的文件快速预览辅助工具，可以将MacOS广受好评的“空格预览”功能带到Windows桌面！</div><a class="blog-slider__button" href="posts/adf6e4b/">详情</a></div></div></div><div class="blog-slider__pagination swiper-pagination-clickable swiper-pagination-bullets"></div></div></div>';
    console.log('已挂载swiper')
    parent.insertAdjacentHTML("afterbegin",child)}
     </script>
<script data-pjax src="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-swiper/swiper/swiper.min.js"></script>
<script data-pjax src="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-swiper@0.18/swiper/swiperindex.js"></script>
<style></style><script data-pjax>function history_calendar_injector_config(){
                var parent_div_git = document.getElementsByClassName('sticky_layout')[0];
                var item_html = '<div class="card-widget card-history"><div class="card-content"><div class="item-headline"><i class="fas fa-clock fa-spin"></i><span>那年今日</span></div><div id="history-baidu" style="height: 100px;overflow: hidden"><div class="history_swiper-container" id="history-container" style="width: 100%;height: 100%"><div class="swiper-wrapper" id="history_container_wrapper" style="height:20px"></div></div></div></div>';
                console.log('已挂载history_calendar')
                // parent_div_git.innerHTML=item_html+parent_div_git.innerHTML // 无报错，但不影响使用(支持pjax跳转)
                parent_div_git.insertAdjacentHTML("afterbegin",item_html) // 有报错，但不影响使用(支持pjax跳转)
            }if( document.getElementsByClassName('sticky_layout')[0] && (location.pathname ==='/'|| '/' ==='all')){

            history_calendar_injector_config()
        } </script><script data-pjax src="https://cdn.jsdelivr.net/gh/Zfour/Butterfly-card-history/baiduhistory/js/main.js"></script><div class="js-pjax"><script async="async">var arr = document.getElementsByClassName('recent-post-item');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__zoomIn');
    arr[i].setAttribute('data-wow-duration', '2s');
    arr[i].setAttribute('data-wow-delay', '500ms');
    arr[i].setAttribute('data-wow-offset', '80');
    arr[i].setAttribute('data-wow-iteration', '1');
  }</script><script async="async">var arr = document.getElementsByClassName('card-widget');
for(var i = 0;i<arr.length;i++){
    arr[i].classList.add('wow');
    arr[i].classList.add('animate__zoomIn');
    arr[i].setAttribute('data-wow-duration', '');
    arr[i].setAttribute('data-wow-delay', '');
    arr[i].setAttribute('data-wow-offset', '');
    arr[i].setAttribute('data-wow-iteration', '');
  }</script></div><script defer src="https://unpkg.zhimg.com/hexo-butterfly-wowjs/lib/wow.min.js"></script><script defer src="https://unpkg.zhimg.com/hexo-butterfly-wowjs/lib/wow_init.js"></script><!-- hexo injector body_end end --><script async>window.onload=function(){var a=document.createElement('script'),b=document.getElementsByTagName('script')[0];a.type='text/javascript',a.async=!0,a.src='/sw-register.js?v='+Date.now(),b.parentNode.insertBefore(a,b)};</script></body></html>